public void ToMainMenu()
 {
     AnnouncementCanvasController.EnableDecisionWindow(
         Localization.GetPhrase(LocalizedPhrase.AskReturnToMainMenu),
         this.ReturnToMainMenu,
         Localization.GetWord(LocalizedWord.Yes),
         AnnouncementCanvasController.DisableDecisionPanel,
         Localization.GetWord(LocalizedWord.No),
         true
         );
 }
 public void ExitButton()
 {
     AnnouncementCanvasController.EnableDecisionWindow(
         Localization.GetPhrase(LocalizedPhrase.AskExit),
         this.ExitGame,
         Localization.GetWord(LocalizedWord.Yes),
         AnnouncementCanvasController.DisableDecisionPanel,
         Localization.GetWord(LocalizedWord.No),
         true
         );
 }
Beispiel #3
0
    public void Redraw()
    {
        // PAINTING PUZZLE BUTTONS
        var        carray = knowledge.buttonsColorCodesArray;
        var        colors = Knowledge.colors;
        GameObject b;
        Transform  bt;
        byte       code;
        int        i = 0;

        for (; i < 64; i++)
        {
            code = carray[i];
            b    = buttons[i];
            if (code != Knowledge.NOCOLOR_CODE)
            {
                bt = buttons[i].transform;
                bt.GetChild(0).GetComponent <RawImage>().color = colors[code];
                if (!b.activeSelf)
                {
                    b.SetActive(true);
                }
            }
            else
            {
                if (b.activeSelf)
                {
                    b.SetActive(false);
                }
            }
        }
        colors = null;
        carray = null;

        // PUZZLE PARTS COUNT
        var parts = knowledge.puzzlePartsCount;

        redpartsPanel.GetChild(1).GetComponent <Text>().text   = parts[Knowledge.REDCOLOR_CODE].ToString();
        greenpartsPanel.GetChild(1).GetComponent <Text>().text = parts[Knowledge.GREENCOLOR_CODE].ToString();
        bluepartsPanel.GetChild(1).GetComponent <Text>().text  = parts[Knowledge.BLUECOLOR_CODE].ToString();
        cyanpartsPanel.GetChild(1).GetComponent <Text>().text  = parts[Knowledge.CYANCOLOR_CODE].ToString();
        var t  = blackpartsPanel;
        var pc = parts[Knowledge.BLACKCOLOR_CODE];

        if (pc > 0)
        {
            t.GetChild(1).GetComponent <Text>().text = pc.ToString();
            if (!t.gameObject.activeSelf)
            {
                t.gameObject.SetActive(true);
            }
        }
        else
        {
            if (t.gameObject.activeSelf)
            {
                t.gameObject.SetActive(false);
            }
        }
        t     = whitepartsPanel;
        pc    = parts[Knowledge.WHITECOLOR_CODE];
        parts = null;
        if (pc > 0)
        {
            t.GetChild(1).GetComponent <Text>().text = pc.ToString();
            if (!t.gameObject.activeSelf)
            {
                t.gameObject.SetActive(true);
            }
        }
        else
        {
            if (t.gameObject.activeSelf)
            {
                t.gameObject.SetActive(false);
            }
        }

        // BACKGROUND and ENDQUEST buttons
        bool buttonAvailable = false;
        int  eri             = knowledge.GetExecutingScenarioIndex();

        for (i = 0; i < Knowledge.ROUTES_COUNT; i++)
        {
            if (i != eri)
            {
                routeBackgrounds[i].color = Color.Lerp(invisibleColor, fulfilledRouteBackgroundColor, knowledge.GetResearchProgress(i));
            }
            else
            {
                routeBackgrounds[i].color = Color.white;
            }
            buttonAvailable = knowledge.IsEndquestButtonAvailable(i);
            if (buttonAvailable)
            {
                if (endQuestButtons[i] == null)
                {
                    var           g        = new GameObject();
                    RectTransform eqButton = g.AddComponent <RectTransform>();
                    eqButton.transform.parent = routeBackgrounds[i].transform;
                    eqButton.anchorMax        = Vector2.zero;
                    eqButton.anchorMin        = Vector2.zero;
                    eqButton.localPosition    = Vector3.zero;
                    float s = Screen.height / 10f;
                    eqButton.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, s);
                    eqButton.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, s);
                    var ri = g.AddComponent <RawImage>();
                    ri.texture = UIController.iconsTexture;
                    ri.uvRect  = UIController.GetIconUVRect(Icons.GuidingStar);
                    var  btn   = g.AddComponent <Button>();
                    byte index = (byte)i;
                    btn.onClick.AddListener(() =>
                    {
                        AnnouncementCanvasController.EnableDecisionWindow(
                            Localization.GetPhrase(LocalizedPhrase.Ask_StartFinalQuest),
                            () => {
                            QuestUI.current.StartEndQuest(index);
                            this.Redraw();
                            // + Эффект
                        }, Localization.GetWord(LocalizedWord.Yes),
                            AnnouncementCanvasController.DisableDecisionPanel,
                            Localization.GetWord(LocalizedWord.No),
                            false
                            );
                    }
                                            );
                    endQuestButtons[i] = g;
                }
                else
                {
                    endQuestButtons[i].gameObject.SetActive(true);
                }
            }
            else
            {
                if (endQuestButtons[i] != null)
                {
                    endQuestButtons[i].gameObject.SetActive(false);
                }
            }
        }
        //
        ascensionLabel.text = ((int)(knowledge.GetCompleteness() * 100f)).ToString() + '%';

        lastChMarkerValue = knowledge.changesMarker;
    }