Пример #1
0
    public bool ChildClicked(int i, PointerEventData eventData)
    {
        var child = transform.GetChild(i);
        var rect  = GetRect(child);

        return(CodePanel.IsInRect(rect, eventData.position));
    }
Пример #2
0
    protected override void Awake()
    {
        base.Awake();

        PanelName = Default.PANEL_TYPE_CODE;

        Ins = this;
    }
Пример #3
0
 void IPersistable.Save(SettingsStorage storage)
 {
     storage.SetValue("Code", Code);
     storage.SetValue("References", CodePanel.References.ToArray());
     storage.SetValue("CodePanel", CodePanel.Save());
     //storage.SetValue("ResultChart", ResultChart.Save());
     //storage.SetValue("ResultGrid", ResultGrid.Save());
     storage.SetValue("Parameters", _parameters.Save());
 }
Пример #4
0
 // Update is called once per frame
 void Update()
 {
     if (levelLoader.ShouldDisplayExecutionIndicators())
     {
         panel = GameObject.Find("SolutionPanel").GetComponent <CodePanel>();
         SortIndicators();
     }
     else
     {
         //ClearIndicators();
     }
 }
Пример #5
0
        void IPersistable.Load(SettingsStorage storage)
        {
            Code = storage.GetValue <string>("Code");
            CodePanel.References.Clear();
            CodePanel.References.AddRange(storage.GetValue <CodeReference[]>("References"));
            CodePanel.Load(storage.GetValue <SettingsStorage>("CodePanel"));
            //ResultChart.Load(storage.GetValue<SettingsStorage>("ResultChart"));
            //ResultGrid.Load(storage.GetValue<SettingsStorage>("ResultGrid"));
            _parameters.Load(storage.GetValue <SettingsStorage>("Parameters"));

            CodePanel_OnCompilingCode();
        }
Пример #6
0
        private void CodePanel_OnCompilingCode()
        {
            var result = CompilationLanguages.CSharp.CompileCode(Code, Guid.NewGuid().ToString(), CodePanel.References,
                                                                 UserConfig.Instance.AnalyticsDir, UserConfig.Instance.AnalyticsDir);

            CodePanel.ShowCompilationResult(result, _analyticStrategy != null);

            if (result.HasErrors())
            {
                return;
            }

            _scriptType = result.Assembly.GetTypes().FirstOrDefault(t => !t.IsAbstract && t.IsSubclassOf(typeof(Strategy)));
        }
Пример #7
0
    public void InstantiateIndicators(List <Bot> bots)
    {
        panel = GameObject.Find("SolutionPanel").GetComponent <CodePanel>();

        foreach (var bot in bots)
        {
            if (indicators.ContainsKey(bot))
            {
                continue;
            }
            var indicator = Instantiate(GameObject.Find("ExecutionIndicator"), panel.transform.Find("RootContainer"), true);
            indicator.GetComponent <Image>().color = bot.Color;
            indicators.Add(bot, indicator);
            indicatorPositions.Add(bot, startingPosition);
        }
    }
Пример #8
0
 void Awake()
 {
     instance = this;
     GetComponent <CanvasScaler>().referenceResolution = new Vector2(Screen.currentResolution.width, Screen.currentResolution.height);
     miniMap        = Instantiate(miniMap, transform);
     datePanel      = Instantiate(datePanel, transform);
     saveLoadPanel  = Instantiate(saveLoadPanel, transform);
     statisticPanel = Instantiate(statisticPanel, transform);
     gameMenu       = Instantiate(gameMenu, transform);
     codePanel      = Instantiate(codePanel, transform);
     // battlePanel = Instantiate(battlePanel, transform);
     provincePanel          = Instantiate(provincePanel, transform);
     armyPanel              = Instantiate(armyPanel, transform);
     HelpManager            = Instantiate(HelpManager, transform);
     saveLoadPanel.prevMenu = gameMenu.gameObject;
 }
Пример #9
0
    public override void _Ready()
    {
        // On ready
        /*#region*/
        code_panel    = GetNode <CodePanel>("MainPanel/CodePanel");
        upgrade_panel = GetNode <Upgrades>("MainPanel/UpgradePanel");
        auto_prod     = GetNode <Autoproductions>("AutoProd");

        work_in_progress = GetNode <Label>("CodeDetailsPanel/CurrentWork");
        line_count       = GetNode <Label>("CodeDetailsPanel/LineCount");
        prod_rate        = GetNode <Label>("CodeDetailsPanel/ProdRate");
        /*#endregion*/

        //TODO: panel selections
        upgrade_panel.Visible = false;
        auto_prod.Connect(nameof(Autoproductions.CharFromBuildings), this, nameof(_OnAutoProduct));
    }
Пример #10
0
    public void OnDrop(PointerEventData eventData)
    {
        Debug.Log("OnDrop - usuwanie obiektu");
        if (eventData.pointerDrag != null)
        {
            if (!CodePanel.HasDraggedObjectAValidTag(eventData))
            {
                Debug.Log($"Invalid tag: {eventData.pointerDrag.tag}");
                return;
            }

            Delete(eventData.pointerDrag);
            //CodePanel.Remove(eventData.pointerDrag);

            //GameObject.Find("RaycastManager").GetComponent<RaycastManagerScript>().SetRaycastBlockingAfterInstructionReleased();
            RaycastManagerScript.SetRaycastBlockingAfterInstructionReleased();
        }
    }
Пример #11
0
        public StrategyInfoCodeContent()
        {
            InitializeComponent();

            _timer          = new ResettableTimer(TimeSpan.FromSeconds(1), "Compilation");
            _timer.Elapsed += canProcess => GuiDispatcher.GlobalDispatcher.AddAction(CompileCode);

            var persSvc = ConfigManager.GetService <IPersistableService>();

            CodePanel.References.AddRange(persSvc.GetReferences());
            CodePanel.ReferencesUpdated += () => persSvc.SetReferences(CodePanel.References);

            CodePanel.SavingCode    += SaveCode;
            CodePanel.CompilingCode += CompileCode;
            CodePanel.CodeChanged   += _timer.Activate;

            var cmdSvc = ConfigManager.GetService <IStudioCommandService>();

            cmdSvc.Register <CompileStrategyInfoResultCommand>(this, true, cmd => CodePanel.ShowCompilationResult(cmd.Result, GetStrategiesState()));
            cmdSvc.Register <EditReferencesCommand>(this, true, cmd => CodePanel.EditReferences());
        }
Пример #12
0
 void IPersistable.Save(SettingsStorage storage)
 {
     storage.SetValue("CodePanel", CodePanel.Save());
 }
Пример #13
0
 void IPersistable.Load(SettingsStorage storage)
 {
     CodePanel.Load(storage.GetValue <SettingsStorage>("CodePanel"));
 }
Пример #14
0
 void OnDestroy()
 {
     Ins = null;
 }
Пример #15
0
 void Awake()
 {
     instance = this;
 }