private void Start()
 {
     GlobalVars.Instance.ApplyAudioSource();
     GlobalVars.Instance.SwitchFlashbang(bVis: false, Vector3.zero);
     GlobalVars.Instance.showBrickId  = -1;
     GlobalVars.Instance.sys10First   = true;
     GlobalVars.Instance.eventBridge  = true;
     GlobalVars.Instance.eventGravity = false;
     BrickManager.Instance.LoadTutorMap(GlobalVars.Instance.isLoadBattleTutor);
     VfxOptimizer.Instance.SetupCamera();
     PaletteManager.Instance.PaletteSet(0, 54, 1);
     tutoInput = GameObject.Find("Main").GetComponent <TutoInput>();
 }
示例#2
0
 public void CheckDragAndDrop()
 {
     if (null != dragAndDrop && custom_inputs.Instance.GetButtonDown("K_FIRE2"))
     {
         dragAndDrop      = null;
         dragAndDropBrick = null;
         TutoInput component = GameObject.Find("Main").GetComponent <TutoInput>();
         if (component != null)
         {
             component.setActive(TUTO_INPUT.M_L);
             component.setClick(TUTO_INPUT.M_L);
             float x = ((float)Screen.width - crdSiloArea.x) / 2f + 4f;
             float y = ((float)Screen.height - crdSiloArea.y) / 2f + 29f;
             component.setChangePos(set: true, new Vector2(x, y));
             component.setBlick(set: true);
             component.setBlickPos(new Rect(x, y, 64f, 64f));
         }
     }
 }
示例#3
0
    private void DoSilo()
    {
        for (int i = 0; i < brickTabKey.Length; i++)
        {
            brickTab[i] = StringMgr.Instance.Get(brickTabKey[i]);
        }
        Rect position = new Rect(((float)Screen.width - crdSiloArea.x) / 2f, ((float)Screen.height - crdSiloArea.y) / 2f, crdSiloArea.x, crdSiloArea.y);

        GUI.BeginGroup(position);
        GUI.Box(crdSiloFrame, string.Empty, "BoxBrickBar");
        currentSilo = GUI.SelectionGrid(crdSiloTab, currentSilo, brickTab, brickTab.Length, "BoxBrickTab");
        switch (currentSilo)
        {
        case 0:
        {
            int num8 = Mathf.FloorToInt((float)(generalIcon.Length / 10));
            if (generalIcon.Length % 10 > 0)
            {
                num8++;
            }
            spGeneral = GUI.BeginScrollView(viewRect: new Rect(0f, 0f, 10f * crdSilo.x + 9f * crdSiloOffset.x, (float)num8 * crdSilo.y + (float)(num8 - 1) * crdSiloOffset.y), position: crdSiloPosition, scrollPosition: spGeneral);
            int num9 = 0;
            for (int num10 = 0; num10 < num8; num10++)
            {
                for (int num11 = 0; num11 < 10; num11++)
                {
                    if (num9 >= generalIcon.Length)
                    {
                        break;
                    }
                    Rect rc4      = new Rect((float)num11 * (crdSilo.x + crdSiloOffset.x), (float)num10 * (crdSilo.y + crdSiloOffset.y), crdSilo.x, crdSilo.y);
                    bool enabled4 = GUI.enabled;
                    GUI.enabled = (general[num9].ticket.Length <= 0 || MyInfoManager.Instance.HaveFunction(general[num9].ticket) >= 0);
                    if (GlobalVars.Instance.MyButton(rc4, generalIcon[num9], new GUIContent(string.Empty, "s" + general[num9].GetIndex().ToString()), "ButtonBrick"))
                    {
                        currentBrick     = num9;
                        dragAndDrop      = generalIcon[num9];
                        dragAndDropBrick = general[num9];
                    }
                    GUI.enabled = enabled4;
                    if (tooltip.TargetBrick != null && tooltip.TargetBrick.GetIndex() == general[num9].GetIndex() && lastTooltip.StartsWith("s"))
                    {
                        ltTooltip = new Vector2(position.x + crdSiloPosition.x + rc4.x + rc4.width, position.y + crdSiloPosition.y + rc4.y - spGeneral.y);
                    }
                    num9++;
                }
            }
            GUI.EndScrollView();
            break;
        }

        case 1:
        {
            int num5 = Mathf.FloorToInt((float)(colorbox.Length / 10));
            if (colorbox.Length % 10 > 0)
            {
                num5++;
            }
            spColor = GUI.BeginScrollView(viewRect: new Rect(0f, 0f, 10f * crdSilo.x + 9f * crdSiloOffset.x, (float)num5 * crdSilo.y + (float)(num5 - 1) * crdSiloOffset.y), position: crdSiloPosition, scrollPosition: spColor);
            int num6 = 0;
            for (int n = 0; n < num5; n++)
            {
                for (int num7 = 0; num7 < 10; num7++)
                {
                    if (num6 >= colorbox.Length)
                    {
                        break;
                    }
                    Rect rc3      = new Rect((float)num7 * (crdSilo.x + crdSiloOffset.x), (float)n * (crdSilo.y + crdSiloOffset.y), crdSilo.x, crdSilo.y);
                    bool enabled3 = GUI.enabled;
                    GUI.enabled = (colorbox[num6].ticket.Length <= 0 || MyInfoManager.Instance.HaveFunction(colorbox[num6].ticket) >= 0);
                    if (GlobalVars.Instance.MyButton(rc3, colorboxIcon[num6], new GUIContent(string.Empty, "s" + colorbox[num6].GetIndex().ToString()), "ButtonBrick"))
                    {
                        currentBrick     = num6;
                        dragAndDrop      = colorboxIcon[num6];
                        dragAndDropBrick = colorbox[num6];
                    }
                    GUI.enabled = enabled3;
                    if (tooltip.TargetBrick != null && tooltip.TargetBrick.GetIndex() == colorbox[num6].GetIndex() && lastTooltip.StartsWith("s"))
                    {
                        ltTooltip = new Vector2(position.x + crdSiloPosition.x + rc3.x + rc3.width, position.y + crdSiloPosition.y + rc3.y - spColor.y);
                    }
                    num6++;
                }
            }
            GUI.EndScrollView();
            break;
        }

        case 2:
        {
            int num3 = Mathf.FloorToInt((float)(accessory.Length / 10));
            if (accessory.Length % 10 > 0)
            {
                num3++;
            }
            spDeco = GUI.BeginScrollView(viewRect: new Rect(0f, 0f, 10f * crdSilo.x + 9f * crdSiloOffset.x, (float)num3 * crdSilo.y + (float)(num3 - 1) * crdSiloOffset.y), position: crdSiloPosition, scrollPosition: spDeco);
            int num4 = 0;
            for (int l = 0; l < num3; l++)
            {
                for (int m = 0; m < 10; m++)
                {
                    if (num4 >= accessory.Length)
                    {
                        break;
                    }
                    Rect rc2      = new Rect((float)m * (crdSilo.x + crdSiloOffset.x), (float)l * (crdSilo.y + crdSiloOffset.y), crdSilo.x, crdSilo.y);
                    bool enabled2 = GUI.enabled;
                    GUI.enabled = (accessory[num4].ticket.Length <= 0 || MyInfoManager.Instance.HaveFunction(accessory[num4].ticket) >= 0);
                    if (GlobalVars.Instance.MyButton(rc2, accessoryIcon[num4], new GUIContent(string.Empty, "s" + accessory[num4].GetIndex().ToString()), "ButtonBrick"))
                    {
                        currentBrick     = num4;
                        dragAndDrop      = accessoryIcon[num4];
                        dragAndDropBrick = accessory[num4];
                    }
                    GUI.enabled = enabled2;
                    if (tooltip.TargetBrick != null && tooltip.TargetBrick.GetIndex() == accessory[num4].GetIndex() && lastTooltip.StartsWith("s"))
                    {
                        ltTooltip = new Vector2(position.x + crdSiloPosition.x + rc2.x + rc2.width, position.y + crdSiloPosition.y + rc2.y - spDeco.y);
                    }
                    num4++;
                }
            }
            GUI.EndScrollView();
            break;
        }

        case 3:
        {
            int num = Mathf.FloorToInt((float)(functionalIcon.Length / 10));
            if (functionalIcon.Length % 10 > 0)
            {
                num++;
            }
            spFunc = GUI.BeginScrollView(viewRect: new Rect(0f, 0f, 10f * crdSilo.x + 9f * crdSiloOffset.x, (float)num * crdSilo.y + (float)(num - 1) * crdSiloOffset.y), position: crdSiloPosition, scrollPosition: spFunc);
            int num2 = 0;
            for (int j = 0; j < num; j++)
            {
                for (int k = 0; k < 10; k++)
                {
                    if (num2 >= functionalIcon.Length)
                    {
                        break;
                    }
                    Rect rc      = new Rect((float)k * (crdSilo.x + crdSiloOffset.x), (float)j * (crdSilo.y + crdSiloOffset.y), crdSilo.x, crdSilo.y);
                    bool enabled = GUI.enabled;
                    if (!Application.loadedLevelName.Contains("Tutor"))
                    {
                        GUI.enabled = (functional[num2].ticket.Length <= 0 || MyInfoManager.Instance.HaveFunction(functional[num2].ticket) >= 0);
                    }
                    if (GlobalVars.Instance.MyButton(rc, functionalIcon[num2], new GUIContent(string.Empty, "s" + functional[num2].GetIndex().ToString()), "ButtonBrick"))
                    {
                        currentBrick     = num2;
                        dragAndDrop      = functionalIcon[num2];
                        dragAndDropBrick = functional[num2];
                        TutoInput component = GameObject.Find("Main").GetComponent <TutoInput>();
                        if (component != null)
                        {
                            float x = pospal1.x;
                            float y = pospal1.y;
                            component.setChangePos(set: true, new Vector2(x, y));
                            component.setBlick(set: true);
                            component.setBlickPos(new Rect(x, y, 64f, 64f));
                        }
                    }
                    if (!Application.loadedLevelName.Contains("Tutor"))
                    {
                        GUI.enabled = enabled;
                    }
                    if (tooltip.TargetBrick != null && tooltip.TargetBrick.GetIndex() == functional[num2].GetIndex() && lastTooltip.StartsWith("s"))
                    {
                        ltTooltip = GUIUtility.GUIToScreenPoint(new Vector2(rc.x + rc.width, rc.y));
                    }
                    num2++;
                }
            }
            GUI.EndScrollView();
            break;
        }
        }
        GUI.EndGroup();
        if (dragAndDrop != null)
        {
            Vector3 mousePosition  = Input.mousePosition;
            float   x2             = mousePosition.x;
            float   num12          = (float)Screen.height;
            Vector3 mousePosition2 = Input.mousePosition;
            Vector2 vector         = new Vector2(x2, num12 - mousePosition2.y);
            GUI.Box(new Rect(vector.x, vector.y, 64f, 64f), dragAndDrop, "BoxBrickSel");
        }
    }
示例#4
0
    private void DoPalette()
    {
        string[] array = new string[10]
        {
            "a",
            "b",
            "c",
            "d",
            "e",
            "f",
            "g",
            "h",
            "i",
            "j"
        };
        string[] array2 = new string[10]
        {
            "K_BRICK1",
            "K_BRICK2",
            "K_BRICK3",
            "K_BRICK4",
            "K_BRICK5",
            "K_BRICK6",
            "K_BRICK7",
            "K_BRICK8",
            "K_BRICK9",
            "K_BRICK0"
        };
        Rect position = new Rect(((float)Screen.width - crdPaletteSize.x) / 2f, 0f, crdPaletteSize.x, crdPaletteSize.y);

        GUI.BeginGroup(position);
        GUI.Box(new Rect(0f, 0f, crdPaletteSize.x, crdPaletteSize.y), string.Empty, "BoxBrickBar");
        for (int i = 0; i < 10; i++)
        {
            Color color = GUI.color;
            if (palette[i] != null && !palette[i].IsEnable(RoomManager.Instance.CurrentRoomType))
            {
                GUI.color = Color.red;
            }
            Rect       rect       = new Rect(crdBrickLT.x + (float)i * (crdPalette.x + offset), crdBrickLT.y, crdPalette.x, crdPalette.y);
            GUIContent gUIContent = null;
            gUIContent = ((palette[i] != null) ? new GUIContent(paletteIcons[i], array[i] + palette[i].GetIndex().ToString()) : new GUIContent(string.Empty, string.Empty));
            if (i == 0)
            {
                pospal1.x = position.x + rect.x;
                pospal1.y = position.y + rect.y;
            }
            if (GlobalVars.Instance.MyButton2(rect, gUIContent, "ButtonBrick"))
            {
                currentPalette = i;
                GlobalVars.Instance.SetWheelKey(i);
                if (dragAndDrop != null && dragAndDropBrick != null && currentBrick >= 0)
                {
                    paletteIcons[i]  = dragAndDrop;
                    palette[i]       = dragAndDropBrick;
                    dragAndDrop      = null;
                    dragAndDropBrick = null;
                    currentBrick     = -1;
                    TutoInput component = GameObject.Find("Main").GetComponent <TutoInput>();
                    if (component != null)
                    {
                        component.setActive(TUTO_INPUT.M_L);
                        component.setClick(TUTO_INPUT.M_L);
                        component.setChangePos(set: false, Vector2.zero);
                        GlobalVars.Instance.eventGravity = true;
                        Switch(on: false);
                    }
                }
            }
            GUI.color = color;
            if (tooltip.TargetBrick != null && palette[i] != null && tooltip.TargetBrick.GetIndex() == palette[i].GetIndex() && lastTooltip.StartsWith(array[i]))
            {
                ltTooltip = new Vector2(position.x + rect.x + rect.width, position.y + rect.y);
            }
            if (currentPalette == i)
            {
                GUI.Box(rect, string.Empty, "BoxBrickSel");
            }
            if (RoomManager.Instance.CurrentRoomType == Room.ROOM_TYPE.MAP_EDITOR)
            {
                LabelUtil.TextOut(new Vector2(rect.x + crdShortcut.x, rect.y + crdShortcut.y), custom_inputs.Instance.GetKeyCodeName(array2[i]), "TinyLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.UpperLeft);
                if (palette[i] != null && palette[i].maxInstancePerMap > 0)
                {
                    int    num = BrickManager.Instance.CountLimitedBrick(palette[i].GetIndex());
                    int    maxInstancePerMap = palette[i].maxInstancePerMap;
                    string text    = num.ToString() + "/" + maxInstancePerMap.ToString();
                    Color  clrText = (num < maxInstancePerMap) ? Color.white : Color.red;
                    LabelUtil.TextOut(new Vector2(rect.x, rect.y + rect.height), text, "TinyLabel", clrText, TextAnchor.LowerLeft);
                }
            }
        }
        GUI.EndGroup();
    }
示例#5
0
    private void ShowDialog(int speaker, string text)
    {
        base.transform.parent.gameObject.BroadcastMessage("OnPreShowDialog");
        ScriptDialog scriptDialog = base.transform.gameObject.AddComponent <ScriptDialog>();

        if (null != scriptDialog)
        {
            string ex = StringMgr.Instance.GetEx(text);
            scriptDialog.Speaker = speaker;
            scriptDialog.Text    = ((ex.Length > 0) ? ex : text);
            TutoInput component = GameObject.Find("Main").GetComponent <TutoInput>();
            if (text.Contains("SYS01"))
            {
                if (component != null)
                {
                    component.setActive(TUTO_INPUT.WASD);
                    component.setClick(TUTO_INPUT.WASD);
                }
            }
            else if (text.Contains("SYS03") || text.Contains("SYS36"))
            {
                if (component != null)
                {
                    component.setActive(TUTO_INPUT.KEYALL);
                    component.setClick((TUTO_INPUT)17);
                }
            }
            else if (text.Contains("SYS05") || text.Contains("SYS07") || text.Contains("SYS08") || text.Contains("SYS09") || text.Contains("SYS12") || text.Contains("SYS14") || text.Contains("SYS23") || text.Contains("SYS30"))
            {
                if (component != null)
                {
                    component.setActive(TUTO_INPUT.WASD);
                    component.setClick(TUTO_INPUT.W);
                }
            }
            else if (text.Contains("SYS06") || text.Contains("SYS15") || text.Contains("SYS24"))
            {
                if (component != null)
                {
                    component.setActive(TUTO_INPUT.M_L);
                    component.setClick(TUTO_INPUT.M_L);
                }
            }
            else if (text.Contains("SYS11") || text.Contains("SYS25"))
            {
                if (component != null)
                {
                    component.setActive(TUTO_INPUT.M_R);
                    component.setClick(TUTO_INPUT.M_R);
                }
            }
            else if (text.Contains("SYS17"))
            {
                if (component != null)
                {
                    component.setActive(TUTO_INPUT.E);
                    component.setClick(TUTO_INPUT.E);
                }
            }
            else if (text.Contains("SYS20"))
            {
                if (component != null)
                {
                    component.setActive(TUTO_INPUT.SPACE);
                    component.setClick(TUTO_INPUT.SPACE);
                    component.setKeyCheck();
                }
            }
            else if (text.Contains("SYS26"))
            {
                if (component != null)
                {
                    component.setActive(TUTO_INPUT.M);
                    component.setClick(TUTO_INPUT.M);
                }
            }
            else if (text.Contains("SYS37"))
            {
                if (component != null)
                {
                    component.setActive(TUTO_INPUT.WASD);
                    component.setClick(TUTO_INPUT.D);
                }
            }
            else if (text.Contains("SYS10") && component != null)
            {
                if (GlobalVars.Instance.sys10First)
                {
                    component.setActive(TUTO_INPUT.M_L);
                    component.setClick(TUTO_INPUT.M_L);
                    GlobalVars.Instance.sys10First = false;
                }
                else
                {
                    component.setActive(TUTO_INPUT.M_R);
                    component.setClick(TUTO_INPUT.M_R);
                }
            }
            if (text.Contains("SYS05") || text.Contains("SYS09") || text.Contains("SYS12") || text.Contains("SYS14") || text.Contains("SYS17") || text.Contains("SYS22"))
            {
                GameObject gameObject = GameObject.Find("Main");
                if (null != gameObject)
                {
                    gameObject.GetComponent <MissionLog>().needPicture();
                }
            }
        }
    }