Esempio n. 1
0
        public MUIButton(MultiplayerHUD owner, Vector2 pos, string labelString)
        {
            Debug.Log($"creating MUIBUTTON {pos}");

            this.owner = owner;

            box = new MUIBox(owner, pos, new Vector2(110f, 30f));

            label = new MUILabel(owner, labelString, Color.white, pos + new Vector2(0, -MUIBox.lineHeight - 5f));

            size     = box.drawSize;
            this.pos = pos - new Vector2(box.drawSize.x, 0);
        }
Esempio n. 2
0
        // private Vector2 size;

        public MUIPlayerList(MultiplayerHUD owner, Vector2 pos)
        {
            Debug.Log("Added MUIPlayer list");

            float longestSteamNameX = 0;
            float yPos = -MUIBox.lineHeight + 5f;

            foreach (ulong s in MonklandSteamManager.connectedPlayers)
            {
                yPos -= MUIBox.lineHeight;
                string steamName = SteamFriends.GetFriendPersonaName((CSteamID)s);

                Color bodyColor = Color.white;
                try
                {
                    bodyColor = MonklandSteamManager.GameManager.playerColors[MonklandSteamManager.connectedPlayers.IndexOf(s)];
                }
                catch (Exception e)
                {
                    Debug.Log($"Error while trying to get color: {e.Message}");
                }
                MUILabel newLabel = new MUILabel(owner, steamName, bodyColor, pos + new Vector2(0, yPos));
                playerLabels.Add(s, newLabel);
                if (newLabel.label.textRect.xMax >= longestSteamNameX)
                {
                    longestSteamNameX = newLabel.label.textRect.xMax;
                }
            }

            box = new MUIBox(owner, pos, (int)longestSteamNameX, playerLabels.Count);

            foreach (KeyValuePair <ulong, MUILabel> kvp in playerLabels)
            {
                MUILabel item = kvp.Value;
                item.pos.y += 15f;
                //item.color = MonklandSteamManager.GameManager.readiedPlayers.Contains(kvp.Key) ? Color.green : Color.red;

                //i++;
            }
        }
Esempio n. 3
0
        public override void Update()
        {
            box.isVisible = this.isVisible;

            box.Update();
            //Update stuff
            {
                //The total height in pixels that the players take up on the scroll menu
                // float messagePixelHeight = 5 + (playerLabels.Count * 25);
                //The max height the scrollbar can display
                // float maxDisplayHeight = this.size.y - 30;
                // float maxDisplayTransition = this.size.y - 40;

                // float difference = messagePixelHeight - maxDisplayHeight;

                //this.pos = Input.mousePosition;

                /*
                 * if (difference < 0)
                 * {
                 *  scrollValue = 0;
                 * }
                 */

                //int i = 0;

                foreach (KeyValuePair <ulong, MUILabel> kvp in playerLabels)
                {
                    MUILabel label = kvp.Value;

                    //item.color = MonklandSteamManager.GameManager.readiedPlayers.Contains(kvp.Key) ? Color.green : Color.red;
                    label.isVisible = this.isVisible;

                    label.Update();

                    //i++;
                }
            }
        }