DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ PrintS() [2/6]

static void OnSelected::PrintS ( float message)
staticprotected

См. определение в файле ScriptConsoleEnfScriptTab.c строка 329

330{
331 protected static ScriptConsoleEnfScriptTab m_Instance;
332 protected int m_EnscriptHistoryRow;
333 protected int m_EnscriptHistoryRowServer;
336 protected PluginLocalEnscriptHistory m_ModuleLocalEnscriptHistory;
337 protected PluginLocalEnscriptHistoryServer m_ModuleLocalEnscriptHistoryServer;
338 protected MultilineEditBoxWidget m_EnfScriptEdit;
339 protected ButtonWidget m_EnfScriptRun;
340 protected ButtonWidget m_EnfScriptClear;
341 protected TextListboxWidget m_ScriptOutputListbox;
342 protected bool m_AllowScriptOutput;
343 protected int m_RunColor;
344
346
347 void ScriptConsoleEnfScriptTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent = null)
348 {
349 m_Instance = this;
350 m_ModuleLocalEnscriptHistory = PluginLocalEnscriptHistory.Cast(GetPlugin(PluginLocalEnscriptHistory));
351 m_ModuleLocalEnscriptHistoryServer = PluginLocalEnscriptHistoryServer.Cast(GetPlugin(PluginLocalEnscriptHistoryServer));
354 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
355 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
356 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
357 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
358 m_RunColor = m_EnfScriptRun.GetColor();
359 }
360
362 {
363 m_Instance = null;
364 }
365
366 override void OnSelected()
367 {
368 int index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
369 if (m_EnscriptConsoleHistory.IsValidIndex(index))
370 {
371 string text = m_EnscriptConsoleHistory.Get(index);
372 m_EnfScriptEdit.SetText(text);
373 }
375 }
376
377 static void PrintS(string message)
378 {
379 Print(message);
380 if (m_Instance)
381 m_Instance.Add(message);
382 }
383
384 static void PrintS(bool message)
385 {
386 PrintS(message.ToString());
387 }
388
389 static void PrintS(int message)
390 {
391 PrintS(message.ToString());
392 }
393
394 static void PrintS(float message)
395 {
396 PrintS(message.ToString());
397 }
398
399 static void PrintS(vector message)
400 {
401 PrintS(message.ToString());
402 }
403
404 static void PrintS(Object message)
405 {
406 PrintS(message.ToString());
407 }
408
409
410 void Add(string message, bool isReload = false)
411 {
412 if (message != string.Empty)
413 {
415 {
416 if (!isReload)
417 m_ScriptOutputHistory.Insert(message);
418 m_ScriptOutputListbox.AddItem(String(message), NULL, 0);
419 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
420 }
421 }
422 }
423
424 protected void Clear(bool clearFile = false)
425 {
426 if(clearFile)
428 m_ScriptOutputListbox.ClearItems();
429 }
430
431
432
433 protected void ReloadScriptOutput()
434 {
435 m_ScriptOutputListbox.ClearItems();
436 m_AllowScriptOutput = true;
437 foreach ( string s: m_ScriptOutputHistory)
438 {
439 Add(s, true);
440 }
441 m_AllowScriptOutput = false;
442 }
443
444 void HistoryBack()
445 {
446
448 }
449
450 void HistoryForward()
451 {
453 }
454
455 protected void RunEnscript()
456 {
457 #ifdef DEVELOPER
458 string code;
459 m_EnfScriptEdit.GetText(code);
460 string codeNoReplace = code;
462 m_AllowScriptOutput = true;
463 code.Replace("Print(","ScriptConsoleEnfScriptTab.PrintS(");
464 code.Replace("Print (","ScriptConsoleEnfScriptTab.PrintS(");
465 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
466 m_AllowScriptOutput = false;
467 ColorRunButton(success);
468
469 m_EnscriptConsoleHistory.Insert(codeNoReplace);
470 m_ModuleLocalEnscriptHistory.AddNewLine(codeNoReplace);
471 #endif
472 }
473
474 protected void ColorRunButton(bool success)
475 {
476 if (success)
477 {
478 m_EnfScriptRun.SetColor(ARGB(255,0,255,0));
479 }
480 else
481 {
482 m_EnfScriptRun.SetColor(ARGB(255,255,0,0));
483 }
485 }
486
487 protected void ResetRunButtonColor()
488 {
489 m_EnfScriptRun.SetColor(m_RunColor);
490 }
491
492 protected void RunEnscriptServer()
493 {
494 string code;
495 m_EnfScriptEdit.GetText(code);
497 m_ModuleLocalEnscriptHistoryServer.AddNewLine(code);
499 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
500 }
501
502 protected void EnscriptHistoryBack()
503 {
504 int history_index;
505 if (m_EnfScriptEdit)
506 {
508 history_index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
509 if (history_index > -1)
510 {
511 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistory.Get(history_index));
512 }
514 }
515 }
516
517
518 protected void EnscriptHistoryForward()
519 {
520 if (m_EnfScriptEdit)
521 {
522 int history_index;
524 history_index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
525 if (history_index < m_EnscriptConsoleHistory.Count())
526 {
527 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistory.Get(history_index));
528 }
530 }
531 }
532
533 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
534 {
535 super.OnRPCEx(rpc_type, ctx);
536 #ifdef DIAG_DEVELOPER
537 switch (rpc_type)
538 {
539 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
540 {
542 {
544 }
545 break;
546 }
547 }
548 #endif
549 }
550
551 override bool OnClick(Widget w, int x, int y, int button)
552 {
553 super.OnClick(w,x,y,button);
554 if (w == m_EnfScriptRun)
555 {
556 RunEnscript();
557 return true;
558 }
559 else if (w == m_EnfScriptClear)
560 {
561 m_ScriptOutputListbox.ClearItems();
562 m_ScriptOutputHistory.Clear();
563 return true;
564 }
565
566 return false;
567 }
568
569 override bool OnChange(Widget w, int x, int y, bool finished)
570 {
571 super.OnChange(w, x, y, finished);
572 return false;
573 }
574
575
576 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
577 {
578 if (!show && (selectedHandler.Type() == ScriptConsoleEnfScriptTab || selectedHandler.Type() == ScriptConsoleEnfScriptServerTab))
579 {
580 //do nothing
581 }
582 else
583 {
584 m_Root.Show(show);
585 m_Root.Enable(show);
586 }
587 }
588
589}
590
591class ScriptConsoleEnfScriptServerTab : ScriptConsoleEnfScriptTab
592{
593 override void OnSelected()
594 {
596 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
597 {
598 string text = m_EnscriptConsoleHistoryServer.Get(index);
599 m_EnfScriptEdit.SetText(text);
600 }
602 }
603
604 override protected void EnscriptHistoryBack()
605 {
606 int history_index;
607 if (m_EnfScriptEdit)
608 {
611 if (history_index > -1)
612 {
613 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistoryServer.Get(history_index));
614 }
616 }
617 }
618
619 override protected void EnscriptHistoryForward()
620 {
621 if (m_EnfScriptEdit)
622 {
623 int history_index;
624
627 if (history_index < m_EnscriptConsoleHistoryServer.Count())
628 {
629 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistoryServer.Get(history_index));
630 }
632 }
633 }
634
635 override bool OnClick(Widget w, int x, int y, int button)
636 {
637 if (w == m_EnfScriptRun)
638 {
640 return true;
641 }
642 else if (w == m_EnfScriptClear)
643 {
644 m_ScriptOutputListbox.ClearItems();
645 m_ScriptOutputHistory.Clear();
646 return true;
647 }
648
649 return false;
650 }
651
652}
void Show()
Определения DayZGame.c:162
ERPCs
Определения ERPCs.c:2
Empty
Определения Hand_States.c:14
Icon x
Icon y
PlayerBase GetPlayer()
Определения ModifierBase.c:51
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
PlayerBase _player
Определения QuickBarBase.c:18
static ref RadialMenu m_Instance
Определения RadialMenu.c:55
ref TStringArray m_EnscriptConsoleHistoryServer
Определения ScriptConsoleEnfScriptTab.c:270
int m_EnscriptHistoryRowServer
Определения ScriptConsoleEnfScriptTab.c:268
override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
Определения ScriptConsoleEnfScriptTab.c:468
ButtonWidget m_EnfScriptClear
Определения ScriptConsoleEnfScriptTab.c:275
ScriptConsoleEnfScriptTab ScriptConsoleTabBase OnSelected()
Определения ScriptConsoleEnfScriptTab.c:265
void ResetRunButtonColor()
Определения ScriptConsoleEnfScriptTab.c:422
void Add(string message, bool isReload=false)
Определения ScriptConsoleEnfScriptTab.c:345
void HistoryForward()
Определения ScriptConsoleEnfScriptTab.c:385
TextListboxWidget m_ScriptOutputListbox
Определения ScriptConsoleEnfScriptTab.c:276
void ScriptConsoleEnfScriptTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
Определения ScriptConsoleEnfScriptTab.c:282
bool m_AllowScriptOutput
Определения ScriptConsoleEnfScriptTab.c:277
static ref TStringArray m_ScriptOutputHistory
Определения ScriptConsoleEnfScriptTab.c:280
int m_RunColor
Определения ScriptConsoleEnfScriptTab.c:278
static void PrintS(string message)
Определения ScriptConsoleEnfScriptTab.c:312
void RunEnscriptServer()
Определения ScriptConsoleEnfScriptTab.c:427
void ~ScriptConsoleEnfScriptTab()
Определения ScriptConsoleEnfScriptTab.c:296
override bool OnClick(Widget w, int x, int y, int button)
Определения ScriptConsoleEnfScriptTab.c:486
PluginLocalEnscriptHistoryServer m_ModuleLocalEnscriptHistoryServer
Определения ScriptConsoleEnfScriptTab.c:272
void Clear(bool clearFile=false)
Определения ScriptConsoleEnfScriptTab.c:359
void ReloadScriptOutput()
Определения ScriptConsoleEnfScriptTab.c:368
ButtonWidget m_EnfScriptRun
Определения ScriptConsoleEnfScriptTab.c:274
void EnscriptHistoryBack()
Определения ScriptConsoleEnfScriptTab.c:437
override bool OnChange(Widget w, int x, int y, bool finished)
Определения ScriptConsoleEnfScriptTab.c:504
void RunEnscript()
Определения ScriptConsoleEnfScriptTab.c:390
int m_EnscriptHistoryRow
Определения ScriptConsoleEnfScriptTab.c:267
void HistoryBack()
Определения ScriptConsoleEnfScriptTab.c:379
PluginLocalEnscriptHistory m_ModuleLocalEnscriptHistory
Определения ScriptConsoleEnfScriptTab.c:271
ref TStringArray m_EnscriptConsoleHistory
Определения ScriptConsoleEnfScriptTab.c:269
void ColorRunButton(bool success)
Определения ScriptConsoleEnfScriptTab.c:409
MultilineEditBoxWidget m_EnfScriptEdit
Определения ScriptConsoleEnfScriptTab.c:273
void EnscriptHistoryForward()
Определения ScriptConsoleEnfScriptTab.c:453
Widget m_Root
Определения SizeToChild.c:91
proto native void RPCSingleParam(Object target, int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient=null)
see CGame.RPC
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
proto native bool ExecuteEnforceScript(string expression, string mainFnName)
Delevoper only: Executes Enforce Script expression, if there is an error, is printed into the script ...
static ref Param1< bool > PARAM1_BOOL
Определения UtilityClasses.c:12
static ref Param1< string > PARAM1_STRING
Определения UtilityClasses.c:14
static void ClearLogs()
Определения Debug.c:557
Определения Debug.c:2
Определения ObjectTyped.c:2
Определения PlayerBaseClient.c:2
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
override void OnSelected()
Определения ScriptConsoleEnfScriptTab.c:38
override bool OnClick(Widget w, int x, int y, int button)
Определения ScriptConsoleEnfScriptTab.c:223
proto bool Read(void value_in)
Определения EnWidgets.c:190
string ToString()
Определения EnConvert.c:3
proto string ToString(bool simple=true)
proto string ToString(bool beautify=true)
Vector to string.
Определения EnConvert.c:106
Serializer ParamsReadContext
Определения gameplay.c:15
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.
array< string > TStringArray
Определения EnScript.c:685
string String(string s)
Helper for passing string expression to functions with void parameter. Example: Print(String("Hello "...
Определения EnScript.c:339
proto int Replace(string sample, string replace)
Replace all occurrances of 'sample' in 'str' by 'replace'.
const int CALL_CATEGORY_SYSTEM
Определения tools.c:8
WorkspaceWidget Widget
Defined in code.
int ARGB(int a, int r, int g, int b)
Определения proto.c:322