コード例 #1
0
    private void OnGUI()
    {
        if (GameData.WorldID == -1)
        {
            return;
        }
        string b = (Event.current.type != EventType.Repaint) ? lastHover : string.Empty;

        GUI.depth = 5;
        GUI.BeginGroup(screenSpace);
        GUI.DrawTexture(mapGroup, mMapImages[GameData.WorldID]);
        GUI.BeginGroup(mapGroup);
        string text  = "BATTLE";
        string empty = string.Empty;

        if (m_networkManager.currentActiveRoom != null)
        {
            int intValue = m_networkManager.currentActiveRoom.GetVariable("hackLimit").GetIntValue();
            empty = "MATCH RULES: " + intValue + " HACKS OR 10 MINUTES";
            if (GameData.BattleType == 2)
            {
                text  = "TEAM BATTLE";
                empty = "MATCH RULES: " + intValue + " HACKS OR 15 MINUTES";
            }
            if (GameData.BattleType == 3)
            {
                text  = "BUDDY BATTLE";
                empty = "MATCH RULES: BUDDY BATTLE RULESET NOT DEFINED.";
            }
        }
        else
        {
            text  = "TRAINING";
            empty = "COMPLETE THE TRAINING MISSION";
        }
        Vector2 vector = QueueSkin.GetStyle("MapNameText").CalcSize(new GUIContent(GameData.WorldName.ToUpper()));

        GUI.Box(new Rect(5f, 5f, vector.x, 30f), GameData.WorldName.ToUpper(), QueueSkin.GetStyle("MapNameText"));
        Vector2 vector2 = QueueSkin.GetStyle("BattleText").CalcSize(new GUIContent(text));

        GUI.Box(new Rect((mapGroup.width - vector2.x) / 2f, 15f, vector2.x, vector2.y), text, QueueSkin.GetStyle("BattleText"));
        Vector2 vector3 = QueueSkin.GetStyle("MatchRulesText").CalcSize(new GUIContent(empty));

        GUI.Box(new Rect((mapGroup.width - vector3.x) / 2f, 55f, vector3.x, vector3.y), empty, QueueSkin.GetStyle("MatchRulesText"));
        string text2 = "WAITING...";
        string str   = string.Format("{0:D2}", m_networkManager.m_qTime);

        if (GameData.getWorldById(GameData.WorldID) == null)
        {
            text2 = "LOADING WORLD";
            Debug.Log("[QueueBattle::OnGUI] World ID is null " + GameData.WorldID + " isworldLoaded: " + isWorldLoaded);
        }
        else if (m_networkManager.currentActiveRoom != null)
        {
            if (!m_networkManager.currentActiveRoom.GetVariable("state").GetStringValue().Equals("play") || 1 == 0)
            {
                text2 = ((!m_networkManager.currentActiveRoom.GetVariable("state").GetStringValue().Equals("wait_for_min_players")) ? ("LAUNCHING GAME 0:" + str) : "WAITING FOR MORE PLAYERS");
            }
            else
            {
                Debug.Log("<<<< showing waiting because game is in: " + m_networkManager.currentActiveRoom.GetVariable("state").GetStringValue());
            }
        }
        GUI.Box(new Rect(mapGroup.width - 200f - 5f - 80f, 5f, 24f, 300f), text2, QueueSkin.GetStyle("WaitingText"));
        GUI.EndGroup();
        GUI.Box(new Rect(0f, mapGroup.height, screenSpace.width, banzaiGroup.y - mapGroup.height), string.Empty, QueueSkin.GetStyle("BlackBox"));
        if (GameData.BattleType != 2)
        {
            GUI.DrawTexture(new Rect(banzaiGroup.x, banzaiGroup.y, banzaiGroup.width + atlasGroup.width + 2f, banzaiGroup.height + atlasGroup.height + 2f), mBattleBackground);
        }
        float num  = 160f;
        float num2 = 3f;
        float num3 = banzaiGroup.width / 2f - (num * 2f + num2 * 1.5f);

        GameData.playerSlots1.Clear();
        GameData.playerSlots2.Clear();
        if (m_networkManager.currentActiveRoom != null)
        {
            foreach (User user in m_networkManager.currentActiveRoom.UserList)
            {
                int factionId = (!(Factions.atlas.ToString() == user.GetVariable("faction").GetStringValue())) ? 1 : 2;
                addPlayerToSlot(factionId, user.PlayerId);
            }
        }
        if (GameData.BattleType != 2)
        {
            for (int i = 0; i < 8; i++)
            {
                int num4 = i % 2;
                int num5 = 0;
                if (GameData.playerSlots1.Contains(i + 1))
                {
                    num5 = i + 1;
                }
                int num6 = i / 2;
                if (num4 == 0)
                {
                    GUI.BeginGroup(banzaiGroup);
                    Rect position = new Rect(num3 + (num + num2) * (float)num6, (banzaiGroup.height - num) / 2f, num, num);
                    showLoadoutCard(num5, position, m_networkManager.getFactionByID(num5));
                    GUI.EndGroup();
                }
                else
                {
                    GUI.BeginGroup(atlasGroup);
                    Rect position2 = new Rect(num3 + (num + num2) * (float)num6, (banzaiGroup.height - num) / 2f, num, num);
                    showLoadoutCard(num5, position2, m_networkManager.getFactionByID(num5));
                    GUI.EndGroup();
                }
            }
        }
        else
        {
            GUI.BeginGroup(banzaiGroup);
            if (GameData.BattleType == 2)
            {
                GUI.DrawTexture(new Rect(0f, 0f, banzaiGroup.width, banzaiGroup.height), mBanzaiImages[2]);
                GUI.DrawTexture(mBanzaiLogoRects[0], mBanzaiImages[0]);
                GUI.DrawTexture(mBanzaiLogoRects[1], mBanzaiImages[1]);
            }
            int count = GameData.playerSlots1.Count;
            for (int j = 0; j < 4; j++)
            {
                int playerId = 0;
                if (j < count)
                {
                    playerId = GameData.playerSlots1[j];
                }
                Rect position3 = new Rect(num3 + (num + num2) * (float)j, (banzaiGroup.height - num) / 2f, num, num);
                showLoadoutCard(playerId, position3, (GameData.BattleType == 2) ? 1 : 0);
            }
            if (GameData.BattleType == 2)
            {
                GUI.Box(new Rect(0f, 0f, banzaiGroup.width, banzaiGroup.height), string.Empty, QueueSkin.GetStyle("BanzaiOutline"));
            }
            GUI.EndGroup();
            GUI.BeginGroup(atlasGroup);
            if (GameData.BattleType == 2)
            {
                GUI.DrawTexture(new Rect(0f, 0f, banzaiGroup.width, banzaiGroup.height), mAtlasImages[2]);
                GUI.DrawTexture(mAtlasLogoRects[0], mAtlasImages[0]);
                GUI.DrawTexture(mAtlasLogoRects[1], mAtlasImages[1]);
            }
            int count2 = GameData.playerSlots2.Count;
            for (int k = 0; k < 4; k++)
            {
                int playerId2 = 0;
                if (k < count2)
                {
                    playerId2 = GameData.playerSlots2[k];
                }
                Rect position4 = new Rect(num3 + (num + num2) * (float)k, (banzaiGroup.height - num) / 2f, num, num);
                showLoadoutCard(playerId2, position4, (GameData.BattleType == 2) ? 2 : 0);
            }
            if (GameData.BattleType == 2)
            {
                GUI.Box(new Rect(0f, 0f, banzaiGroup.width, banzaiGroup.height), string.Empty, QueueSkin.GetStyle("AtlasOutline"));
            }
            GUI.EndGroup();
        }
        GUI.BeginGroup(chatGroup);
        chat.drawChatWindow(chatGroup);
        switch (GUIUtil.Button(new Rect(chatGroup.width - 160f, chatGroup.height - 47f, 67f, 34f), "STATS", QueueSkin.GetStyle("Quit_Button")))
        {
        case GUIUtil.GUIState.Hover:
        case GUIUtil.GUIState.Active:
            if (Event.current.type == EventType.Repaint)
            {
                b = "STATS";
                if (lastHover != b)
                {
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                }
            }
            break;

        case GUIUtil.GUIState.Click:
            b = "STATS";
            GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
            gameSummary.mDraw = true;
            break;
        }
        switch (GUIUtil.Button(new Rect(chatGroup.width - 85f, chatGroup.height - 47f, 67f, 34f), "QUIT", QueueSkin.GetStyle("Quit_Button")))
        {
        case GUIUtil.GUIState.Hover:
        case GUIUtil.GUIState.Active:
            if (Event.current.type == EventType.Repaint)
            {
                b = "QUIT";
                if (lastHover != b)
                {
                    GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Over);
                }
            }
            break;

        case GUIUtil.GUIState.Click:
            b = "QUIT";
            GUIUtil.PlayGUISound(GUIUtil.GUISoundClips.TT_Global_Button_Press);
            HandlePlayerQuit();
            break;
        }
        GUIUtil.GUIEnable(bEnable: true);
        GUI.EndGroup();
        if (GameData.CurPlayState == GameData.PlayState.GAME_SUMMARY_RECEIVED)
        {
            gameSummary.TakeSnapshot();
            gameSummary.mDraw     = true;
            GameData.CurPlayState = GameData.PlayState.GAME_IN_QUEUE;
        }
        if (gameSummary.mDraw)
        {
            gameSummary.Draw();
        }
        lastHover = b;
        GUI.EndGroup();
    }