Beispiel #1
0
        /// <summary>
        /// Draws the Loading Screen
        /// </summary>
        public void OnGUI()
        {
            GUI.skin = _zodiacStyle;
            GUIOperations.DrawLabelCenteredAt(Screen.width / 2, Screen.height * 5 / 6, (int)(0.1f * Screen.width), "Loading");
            int top       = (int)(Screen.height * 0.15f);
            int topoffset = (int)(0.05f * Screen.height);
            int left;
            int leftoffset = Screen.width / 3;

            if (GameManager.GetInstance().PlayerCount == 1)
            {
                left = Screen.width / 2;
            }
            else
            {
                left = Screen.width / 3;
            }

            for (int i = 1; i <= GameManager.GetInstance().PlayerCount; i++)
            {
                ControlKeysManager c = ConfigManager.GetInstance().GetControlKeysForPlayer(i);
                GUIOperations.DrawLabelCenteredAt(left, top - topoffset, (int)(0.04f * Screen.width), "Player " + i);
                GUIOperations.DrawLabelCenteredAt(left, top + topoffset, (int)(0.02f * Screen.width), "Walk up: " + ConfigManager.KeyToString(c.ForwardKey));
                GUIOperations.DrawLabelCenteredAt(left, top + (2 * topoffset), (int)(0.02f * Screen.width), "Walk down: " + ConfigManager.KeyToString(c.BackwardKey));
                GUIOperations.DrawLabelCenteredAt(left, top + (3 * topoffset), (int)(0.02f * Screen.width), "Walk left: " + ConfigManager.KeyToString(c.LeftKey));
                GUIOperations.DrawLabelCenteredAt(left, top + (4 * topoffset), (int)(0.02f * Screen.width), "Walk right: " + ConfigManager.KeyToString(c.RightKey));
                GUIOperations.DrawLabelCenteredAt(left, top + (5 * topoffset), (int)(0.02f * Screen.width), "Attack: " + ConfigManager.KeyToString(c.AttackKey));
                GUIOperations.DrawLabelCenteredAt(left, top + (6 * topoffset), (int)(0.02f * Screen.width), "Defend: " + ConfigManager.KeyToString(c.DefendKey));
                GUIOperations.DrawLabelCenteredAt(left, top + (7 * topoffset), (int)(0.02f * Screen.width), "Jump: " + ConfigManager.KeyToString(c.JumpKey));
                GUIOperations.DrawLabelCenteredAt(left, top + (8 * topoffset), (int)(0.02f * Screen.width), "Pickup & Use: " + ConfigManager.KeyToString(c.PickupKey));
                GUIOperations.DrawLabelCenteredAt(left, top + (9 * topoffset), (int)(0.02f * Screen.width), "Drop: " + ConfigManager.KeyToString(c.DropItemKey));
                left += leftoffset;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Draws the TeamBoxes for the Special mode
        /// </summary>
        private void DrawTeamBoxesSpecial()
        {
            float teamAreaLeft = _displayLeft;
            float teamAreaTop  = _displayTop;

            _infoPercentage = 0;
            _teamAreaWidth  = _displayWidth * (1 - _infoPercentage);
            GUIStyle teamLabelStyle = new GUIStyle(GUI.skin.label);
            GUIStyle baseLabelStyle = new GUIStyle(GUI.skin.label);
            GUIStyle infoTextStyle  = new GUIStyle(GUI.skin.label);

            baseLabelStyle.alignment = TextAnchor.MiddleLeft;
            teamLabelStyle.alignment = TextAnchor.UpperLeft;
            infoTextStyle.alignment  = TextAnchor.MiddleCenter;
            float teamWidth  = _teamAreaWidth / _teamList.Count;
            float teamHeight = Screen.height * _fillingLevel * (2f / 3);

            teamLabelStyle.fontSize = (int)(teamWidth * .02f);

            // the height of the Team area is determined by the filling level (it is 2/3 because the mercenary boxes also have to fit)
            for (int i = 0; i < _teamList.Count; i++)
            {
                Texture2D        barTexture    = (i == 0) ? _manaBarTexture : _healthBarTexture;
                List <Character> characterList = _teamList[i].GetAllTeamMembers();

                int   mCount   = _teamList[i].GetMercenaryTeamMembers().Count + _teamList[i].GetMobTeamMembers().Count;
                float teamXPos = _displayLeft + (i * teamWidth);
                GUI.Label(new Rect(teamXPos, teamAreaTop, teamWidth, teamHeight), "Team " + _teamList[i].TeamNo + ":", teamLabelStyle);
                float  boxOffset      = 1f / 10 * teamWidth;
                float  boxWidth       = teamWidth - boxOffset;
                float  baseLabelWidth = boxWidth / 8;
                float  baseLabelLeft  = (teamXPos + boxOffset) + (boxOffset / 10);
                float  barWidth       = (boxWidth / 2) - baseLabelWidth;
                float  barFactor      = ((float)_teamList[i].Base.HP) / _teamList[i].Base.MaxHP;
                string infoString     = "Captured " + _teamList[i].CapturedCheckpoints.Count + " Checkpoint\r\n" +
                                        "Received " + _teamList[i].Points + " Points\r\n" +
                                        "There are " + mCount + " servants";
                GUI.Box(new Rect(teamXPos + boxOffset, teamAreaTop, boxWidth, teamHeight), string.Empty);
                GUI.Label(new Rect(baseLabelLeft, teamAreaTop, baseLabelWidth, teamHeight), "Base: ", baseLabelStyle);
                GUI.DrawTexture(new Rect(baseLabelLeft + baseLabelWidth, teamAreaTop + (teamHeight / 3), barFactor * barWidth, teamHeight / 3), barTexture);
                GUI.Label(new Rect(baseLabelLeft + baseLabelWidth + barWidth + (boxOffset / 10), teamAreaTop, (teamWidth / 2) - (boxOffset / 10), teamHeight), infoString, baseLabelStyle);
            }

            int c = 0;

            if (_net.IsServer)
            {
                c = GameObject.Find("HeroServer").GetComponent <Hero>().RespawnCountdown;
            }
            else if (_net.IsClient)
            {
                c = GameObject.Find("HeroClient" + _net.ClientNumber).GetComponent <Hero>().RespawnCountdown;
            }
            else
            {
                c = GameObject.Find("Hero1").GetComponent <Hero>().RespawnCountdown;
            }

            if (c > 0)
            {
                GUIStyle labelStyle = new GUIStyle(GUI.skin.label);
                labelStyle.normal.textColor = Color.red;
                labelStyle.fontSize         = (int)(0.2 * Screen.width);
                GUIOperations.DrawLabelCenteredAt(Screen.width / 2, Screen.height / 3, (int)(0.05 * Screen.width), "Respawning in:");
                GUIOperations.DrawLabelCenteredAt(Screen.width / 2, 2 * Screen.height / 3, (int)(0.2 * Screen.width), c.ToString(), labelStyle);
            }
        }