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

◆ PrintS() [3/6]

static void OnSelected::PrintS ( int message)
staticprotected

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

329{
330 protected static ScriptConsoleEnfScriptTab m_Instance;
331 protected int m_EnscriptHistoryRow;
332 protected int m_EnscriptHistoryRowServer;
335 protected PluginLocalEnscriptHistory m_ModuleLocalEnscriptHistory;
336 protected PluginLocalEnscriptHistoryServer m_ModuleLocalEnscriptHistoryServer;
337 protected MultilineEditBoxWidget m_EnfScriptEdit;
338 protected ButtonWidget m_EnfScriptRun;
339 protected ButtonWidget m_EnfScriptClear;
340 protected TextListboxWidget m_ScriptOutputListbox;
341 protected bool m_AllowScriptOutput;
342 protected int m_RunColor;
343
345
346 override void InitializeTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent = null)
347 {
348 super.InitializeTab(root, console, button, parent);
349
350 m_Instance = this;
351 m_ModuleLocalEnscriptHistory = PluginLocalEnscriptHistory.Cast(GetPlugin(PluginLocalEnscriptHistory));
352 m_ModuleLocalEnscriptHistoryServer = PluginLocalEnscriptHistoryServer.Cast(GetPlugin(PluginLocalEnscriptHistoryServer));
355 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(root.FindAnyWidget("MultilineEditBoxWidget0"));
356 m_EnfScriptRun = ButtonWidget.Cast(root.FindAnyWidget("RunButton"));
357 m_EnfScriptClear = ButtonWidget.Cast(root.FindAnyWidget("ClearButton"));
358 m_ScriptOutputListbox = TextListboxWidget.Cast(root.FindAnyWidget("ScriptOutputListbox"));
359 m_RunColor = m_EnfScriptRun.GetColor();
360 }
361
363 {
364 m_Instance = null;
365 }
366
367 override void OnSelected()
368 {
369 int index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
370 if (m_EnscriptConsoleHistory.IsValidIndex(index))
371 {
372 string text = m_EnscriptConsoleHistory.Get(index);
373 m_EnfScriptEdit.SetText(text);
374 }
376 }
377
378 static void PrintS(string message)
379 {
380 Print(message);
381 if (m_Instance)
382 m_Instance.Add(message);
383 }
384
385 static void PrintS(bool message)
386 {
387 PrintS(message.ToString());
388 }
389
390 static void PrintS(int message)
391 {
392 PrintS(message.ToString());
393 }
394
395 static void PrintS(float message)
396 {
397 PrintS(message.ToString());
398 }
399
400 static void PrintS(vector message)
401 {
402 PrintS(message.ToString());
403 }
404
405 static void PrintS(Object message)
406 {
407 PrintS(message.ToString());
408 }
409
410
411 void Add(string message, bool isReload = false)
412 {
413 if (message != string.Empty)
414 {
416 {
417 if (!isReload)
418 m_ScriptOutputHistory.Insert(message);
419 m_ScriptOutputListbox.AddItem(String(message), NULL, 0);
420 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
421 }
422 }
423 }
424
425 protected void Clear(bool clearFile = false)
426 {
427 if(clearFile)
429 m_ScriptOutputListbox.ClearItems();
430 }
431
432
433
434 protected void ReloadScriptOutput()
435 {
436 m_ScriptOutputListbox.ClearItems();
437 m_AllowScriptOutput = true;
438 foreach ( string s: m_ScriptOutputHistory)
439 {
440 Add(s, true);
441 }
442 m_AllowScriptOutput = false;
443 }
444
445 void HistoryBack()
446 {
447
449 }
450
451 void HistoryForward()
452 {
454 }
455
456 protected void RunEnscript()
457 {
458 #ifdef DEVELOPER
459 string code;
460 m_EnfScriptEdit.GetText(code);
461 string codeNoReplace = code;
462 _player = PlayerBase.Cast(g_Game.GetPlayer());
463 m_AllowScriptOutput = true;
464 code.Replace("Print(","ScriptConsoleEnfScriptTab.PrintS(");
465 code.Replace("Print (","ScriptConsoleEnfScriptTab.PrintS(");
466 bool success = g_Game.ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
467 m_AllowScriptOutput = false;
468 ColorRunButton(success);
469
470 m_EnscriptConsoleHistory.Insert(codeNoReplace);
471 m_ModuleLocalEnscriptHistory.AddNewLine(codeNoReplace);
472 #endif
473 }
474
475 protected void ColorRunButton(bool success)
476 {
477 if (success)
478 {
479 m_EnfScriptRun.SetColor(ARGB(255,0,255,0));
480 }
481 else
482 {
483 m_EnfScriptRun.SetColor(ARGB(255,255,0,0));
484 }
485 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor,600);
486 }
487
488 protected void ResetRunButtonColor()
489 {
490 m_EnfScriptRun.SetColor(m_RunColor);
491 }
492
493 protected void RunEnscriptServer()
494 {
495 string code;
496 m_EnfScriptEdit.GetText(code);
498 m_ModuleLocalEnscriptHistoryServer.AddNewLine(code);
500 g_Game.RPCSingleParam(g_Game.GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, g_Game.GetPlayer().GetIdentity());
501 }
502
503 protected void EnscriptHistoryBack()
504 {
505 int history_index;
506 if (m_EnfScriptEdit)
507 {
509 history_index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
510 if (history_index > -1)
511 {
512 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistory.Get(history_index));
513 }
515 }
516 }
517
518
519 protected void EnscriptHistoryForward()
520 {
521 if (m_EnfScriptEdit)
522 {
523 int history_index;
525 history_index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
526 if (history_index < m_EnscriptConsoleHistory.Count())
527 {
528 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistory.Get(history_index));
529 }
531 }
532 }
533
534 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
535 {
536 super.OnRPCEx(rpc_type, ctx);
537 #ifdef DIAG_DEVELOPER
538 switch (rpc_type)
539 {
540 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
541 {
543 {
545 }
546 break;
547 }
548 }
549 #endif
550 }
551
552 override bool OnClick(Widget w, int x, int y, int button)
553 {
554 super.OnClick(w,x,y,button);
555 if (w == m_EnfScriptRun)
556 {
557 RunEnscript();
558 return true;
559 }
560 else if (w == m_EnfScriptClear)
561 {
562 m_ScriptOutputListbox.ClearItems();
563 m_ScriptOutputHistory.Clear();
564 return true;
565 }
566
567 return false;
568 }
569
570 override bool OnChange(Widget w, int x, int y, bool finished)
571 {
572 super.OnChange(w, x, y, finished);
573 return false;
574 }
575
576
577 override void Show(bool show, ScriptConsoleTabBase selectedHandler)
578 {
579 if (!show && (selectedHandler.Type() == ScriptConsoleEnfScriptTab || selectedHandler.Type() == ScriptConsoleEnfScriptServerTab))
580 {
581 //do nothing
582 }
583 else
584 {
585 m_Root.Show(show);
586 m_Root.Enable(show);
587 }
588 }
589
590}
591
592class ScriptConsoleEnfScriptServerTab : ScriptConsoleEnfScriptTab
593{
594 override void OnSelected()
595 {
597
599 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
600 {
601 string text = m_EnscriptConsoleHistoryServer.Get(index);
602 m_EnfScriptEdit.SetText(text);
603 }
605 }
606
607 override protected void EnscriptHistoryBack()
608 {
609 int history_index;
610 if (m_EnfScriptEdit)
611 {
614 if (history_index > -1)
615 {
616 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistoryServer.Get(history_index));
617 }
619 }
620 }
621
622 override protected void EnscriptHistoryForward()
623 {
624 if (m_EnfScriptEdit)
625 {
626 int history_index;
627
630 if (history_index < m_EnscriptConsoleHistoryServer.Count())
631 {
632 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistoryServer.Get(history_index));
633 }
635 }
636 }
637
638 override bool OnClick(Widget w, int x, int y, int button)
639 {
640 if (w == m_EnfScriptRun)
641 {
643 return true;
644 }
645 else if (w == m_EnfScriptClear)
646 {
647 m_ScriptOutputListbox.ClearItems();
648 m_ScriptOutputHistory.Clear();
649 return true;
650 }
651
652 return false;
653 }
654}
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