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

◆ PrintS() [6/6]

static void OnSelected::PrintS ( vector message)
staticprotected

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

339{
340 protected static ScriptConsoleEnfScriptTab m_Instance;
341 protected int m_EnscriptHistoryRow;
342 protected int m_EnscriptHistoryRowServer;
345 protected PluginLocalEnscriptHistory m_ModuleLocalEnscriptHistory;
346 protected PluginLocalEnscriptHistoryServer m_ModuleLocalEnscriptHistoryServer;
347 protected MultilineEditBoxWidget m_EnfScriptEdit;
348 protected ButtonWidget m_EnfScriptRun;
349 protected ButtonWidget m_EnfScriptClear;
350 protected TextListboxWidget m_ScriptOutputListbox;
351 protected bool m_AllowScriptOutput;
352 protected int m_RunColor;
353
355
356 override void InitializeTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent = null)
357 {
358 super.InitializeTab(root, console, button, parent);
359
360 m_Instance = this;
361 m_ModuleLocalEnscriptHistory = PluginLocalEnscriptHistory.Cast(GetPlugin(PluginLocalEnscriptHistory));
362 m_ModuleLocalEnscriptHistoryServer = PluginLocalEnscriptHistoryServer.Cast(GetPlugin(PluginLocalEnscriptHistoryServer));
365 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
366 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
367 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
368 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
369 m_RunColor = m_EnfScriptRun.GetColor();
370 }
371
373 {
374 m_Instance = null;
375 }
376
377 override void OnSelected()
378 {
379 int index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
380 if (m_EnscriptConsoleHistory.IsValidIndex(index))
381 {
382 string text = m_EnscriptConsoleHistory.Get(index);
383 m_EnfScriptEdit.SetText(text);
384 }
386 }
387
388 static void PrintS(string message)
389 {
390 Print(message);
391 if (m_Instance)
392 m_Instance.Add(message);
393 }
394
395 static void PrintS(bool message)
396 {
397 PrintS(message.ToString());
398 }
399
400 static void PrintS(int message)
401 {
402 PrintS(message.ToString());
403 }
404
405 static void PrintS(float message)
406 {
407 PrintS(message.ToString());
408 }
409
410 static void PrintS(vector message)
411 {
412 PrintS(message.ToString());
413 }
414
415 static void PrintS(Object message)
416 {
417 PrintS(message.ToString());
418 }
419
420
421 void Add(string message, bool isReload = false)
422 {
423 if (message != string.Empty)
424 {
426 {
427 if (!isReload)
428 m_ScriptOutputHistory.Insert(message);
429 m_ScriptOutputListbox.AddItem(String(message), NULL, 0);
430 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
431 }
432 }
433 }
434
435 protected void Clear(bool clearFile = false)
436 {
437 if(clearFile)
439 m_ScriptOutputListbox.ClearItems();
440 }
441
442
443
444 protected void ReloadScriptOutput()
445 {
446 m_ScriptOutputListbox.ClearItems();
447 m_AllowScriptOutput = true;
448 foreach ( string s: m_ScriptOutputHistory)
449 {
450 Add(s, true);
451 }
452 m_AllowScriptOutput = false;
453 }
454
455 void HistoryBack()
456 {
457
459 }
460
461 void HistoryForward()
462 {
464 }
465
466 protected void RunEnscript()
467 {
468 #ifdef DEVELOPER
469 string code;
470 m_EnfScriptEdit.GetText(code);
471 string codeNoReplace = code;
472 _player = PlayerBase.Cast(g_Game.GetPlayer());
473 m_AllowScriptOutput = true;
474 code.Replace("Print(","ScriptConsoleEnfScriptTab.PrintS(");
475 code.Replace("Print (","ScriptConsoleEnfScriptTab.PrintS(");
476 bool success = g_Game.ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
477 m_AllowScriptOutput = false;
478 ColorRunButton(success);
479
480 m_EnscriptConsoleHistory.Insert(codeNoReplace);
481 m_ModuleLocalEnscriptHistory.AddNewLine(codeNoReplace);
482 #endif
483 }
484
485 protected void ColorRunButton(bool success)
486 {
487 if (success)
488 {
489 m_EnfScriptRun.SetColor(ARGB(255,0,255,0));
490 }
491 else
492 {
493 m_EnfScriptRun.SetColor(ARGB(255,255,0,0));
494 }
495 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor,600);
496 }
497
498 protected void ResetRunButtonColor()
499 {
500 m_EnfScriptRun.SetColor(m_RunColor);
501 }
502
503 protected void RunEnscriptServer()
504 {
505 string code;
506 m_EnfScriptEdit.GetText(code);
508 m_ModuleLocalEnscriptHistoryServer.AddNewLine(code);
510 g_Game.RPCSingleParam(g_Game.GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, g_Game.GetPlayer().GetIdentity());
511 }
512
513 protected void EnscriptHistoryBack()
514 {
515 int history_index;
516 if (m_EnfScriptEdit)
517 {
519 history_index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
520 if (history_index > -1)
521 {
522 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistory.Get(history_index));
523 }
525 }
526 }
527
528
529 protected void EnscriptHistoryForward()
530 {
531 if (m_EnfScriptEdit)
532 {
533 int history_index;
535 history_index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
536 if (history_index < m_EnscriptConsoleHistory.Count())
537 {
538 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistory.Get(history_index));
539 }
541 }
542 }
543
544 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
545 {
546 super.OnRPCEx(rpc_type, ctx);
547 #ifdef DIAG_DEVELOPER
548 switch (rpc_type)
549 {
550 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
551 {
553 {
555 }
556 break;
557 }
558 }
559 #endif
560 }
561
562 override bool OnClick(Widget w, int x, int y, int button)
563 {
564 super.OnClick(w,x,y,button);
565 if (w == m_EnfScriptRun)
566 {
567 RunEnscript();
568 return true;
569 }
570 else if (w == m_EnfScriptClear)
571 {
572 m_ScriptOutputListbox.ClearItems();
573 m_ScriptOutputHistory.Clear();
574 return true;
575 }
576
577 return false;
578 }
579
580 override bool OnChange(Widget w, int x, int y, bool finished)
581 {
582 super.OnChange(w, x, y, finished);
583 return false;
584 }
585
586
587 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
588 {
589 if (!show && (selectedHandler.Type() == ScriptConsoleEnfScriptTab || selectedHandler.Type() == ScriptConsoleEnfScriptServerTab))
590 {
591 //do nothing
592 }
593 else
594 {
595 m_Root.Show(show);
596 m_Root.Enable(show);
597 }
598 }
599
600}
601
602class ScriptConsoleEnfScriptServerTab : ScriptConsoleEnfScriptTab
603{
604 override void OnSelected()
605 {
607
609 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
610 {
611 string text = m_EnscriptConsoleHistoryServer.Get(index);
612 m_EnfScriptEdit.SetText(text);
613 }
615 }
616
617 override protected void EnscriptHistoryBack()
618 {
619 int history_index;
620 if (m_EnfScriptEdit)
621 {
624 if (history_index > -1)
625 {
626 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistoryServer.Get(history_index));
627 }
629 }
630 }
631
632 override protected void EnscriptHistoryForward()
633 {
634 if (m_EnfScriptEdit)
635 {
636 int history_index;
637
640 if (history_index < m_EnscriptConsoleHistoryServer.Count())
641 {
642 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistoryServer.Get(history_index));
643 }
645 }
646 }
647
648 override bool OnClick(Widget w, int x, int y, int button)
649 {
650 if (w == m_EnfScriptRun)
651 {
653 return true;
654 }
655 else if (w == m_EnfScriptClear)
656 {
657 m_ScriptOutputListbox.ClearItems();
658 m_ScriptOutputHistory.Clear();
659 return true;
660 }
661
662 return false;
663 }
664}
override void Clear()
Определения ConstructionInfoIcons.c:41
DayZGame g_Game
Определения DayZGame.c:4074
void Show()
Определения DayZGame.c:171
ERPCs
Определения ERPCs.c:2
Empty
Определения Hand_States.c:14
Icon x
Icon y
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:326
PlayerBase _player
Определения QuickBarBase.c:18
static ref RadialMenu m_Instance
Определения RadialMenu.c:55
void ScriptConsole()
Определения ScriptConsole.c:114
ref TStringArray m_EnscriptConsoleHistoryServer
Определения ScriptConsoleEnfScriptTab.c:272
int m_EnscriptHistoryRowServer
Определения ScriptConsoleEnfScriptTab.c:270
override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
Определения ScriptConsoleEnfScriptTab.c:472
ButtonWidget m_EnfScriptClear
Определения ScriptConsoleEnfScriptTab.c:277
ScriptConsoleEnfScriptTab ScriptConsoleTabBase OnSelected()
Определения ScriptConsoleEnfScriptTab.c:267
void ResetRunButtonColor()
Определения ScriptConsoleEnfScriptTab.c:426
void Add(string message, bool isReload=false)
Определения ScriptConsoleEnfScriptTab.c:349
void HistoryForward()
Определения ScriptConsoleEnfScriptTab.c:389
TextListboxWidget m_ScriptOutputListbox
Определения ScriptConsoleEnfScriptTab.c:278
bool m_AllowScriptOutput
Определения ScriptConsoleEnfScriptTab.c:279
static ref TStringArray m_ScriptOutputHistory
Определения ScriptConsoleEnfScriptTab.c:282
int m_RunColor
Определения ScriptConsoleEnfScriptTab.c:280
static void PrintS(string message)
Определения ScriptConsoleEnfScriptTab.c:316
void RunEnscriptServer()
Определения ScriptConsoleEnfScriptTab.c:431
void ~ScriptConsoleEnfScriptTab()
Определения ScriptConsoleEnfScriptTab.c:300
override bool OnClick(Widget w, int x, int y, int button)
Определения ScriptConsoleEnfScriptTab.c:490
PluginLocalEnscriptHistoryServer m_ModuleLocalEnscriptHistoryServer
Определения ScriptConsoleEnfScriptTab.c:274
void ReloadScriptOutput()
Определения ScriptConsoleEnfScriptTab.c:372
ButtonWidget m_EnfScriptRun
Определения ScriptConsoleEnfScriptTab.c:276
void EnscriptHistoryBack()
Определения ScriptConsoleEnfScriptTab.c:441
override bool OnChange(Widget w, int x, int y, bool finished)
Определения ScriptConsoleEnfScriptTab.c:508
void RunEnscript()
Определения ScriptConsoleEnfScriptTab.c:394
override void InitializeTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
Определения ScriptConsoleEnfScriptTab.c:284
int m_EnscriptHistoryRow
Определения ScriptConsoleEnfScriptTab.c:269
void HistoryBack()
Определения ScriptConsoleEnfScriptTab.c:383
PluginLocalEnscriptHistory m_ModuleLocalEnscriptHistory
Определения ScriptConsoleEnfScriptTab.c:273
ref TStringArray m_EnscriptConsoleHistory
Определения ScriptConsoleEnfScriptTab.c:271
void ColorRunButton(bool success)
Определения ScriptConsoleEnfScriptTab.c:413
MultilineEditBoxWidget m_EnfScriptEdit
Определения ScriptConsoleEnfScriptTab.c:275
void EnscriptHistoryForward()
Определения ScriptConsoleEnfScriptTab.c:457
Widget m_Root
Определения SizeToChild.c:91
static ref Param1< bool > PARAM1_BOOL
Определения UtilityClasses.c:12
static ref Param1< string > PARAM1_STRING
Определения UtilityClasses.c:14
static void ClearLogs()
Определения 3_Game/DayZ/tools/Debug.c:666
Определения 3_Game/DayZ/tools/Debug.c:2
Определения ObjectTyped.c:2
Определения PlayerBaseClient.c:2
override void OnSelected()
Определения ScriptConsoleEnfScriptTab.c:40
override bool OnClick(Widget w, int x, int y, int button)
Определения ScriptConsoleEnfScriptTab.c:225
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:119
Serializer ParamsReadContext
Определения gameplay.c:15
proto void Print(void var)
Prints content of variable to console/log.
string String(string s)
Helper for passing string expression to functions with void parameter. Example: Print(String("Hello "...
Определения EnScript.c:339
class array< Class T > TStringArray
proto int Replace(string sample, string replace)
Replace all occurrances of 'sample' in 'str' by 'replace'.
proto string Get(int index)
Gets n-th character from string.
const int CALL_CATEGORY_SYSTEM
Определения 3_Game/DayZ/tools/tools.c:8
proto native void SetFocus(Widget w)
WorkspaceWidget Widget
Defined in code.
int ARGB(int a, int r, int g, int b)
Определения proto.c:322