Example #1
0
 public MUIPlayerTag(AbstractPhysicalObject player, string name, Color color, MultiplayerHUD owner)
 {
     //MonklandUI.AddMessage($"Added label for player {name}[{AbstractPhysicalObjectHK.GetField(player).owner}]");
     this.player          = player;
     this.labelName       = name;
     this.pos             = new Vector2(-1000f, -1000f);
     this.gradient        = new FSprite("Futile_White", true);
     this.gradient.shader = owner.hud.rainWorld.Shaders["FlatLight"];
     this.owner           = owner;
     this.owner.hud.fContainers[0].AddChild(this.gradient);
     this.gradient.alpha = 0f;
     this.gradient.x     = -1000f;
     this.label          = new FLabel("font", labelName);
     this.color          = color;
     this.label.color    = color;
     this.owner.hud.fContainers[0].AddChild(this.label);
     this.label.alpha       = 0f;
     this.label.x           = -1000f;
     this.arrowSprite       = new FSprite("Multiplayer_Arrow", true);
     this.arrowSprite.color = color;
     this.owner.hud.fContainers[0].AddChild(this.arrowSprite);
     this.arrowSprite.alpha = 0f;
     this.arrowSprite.x     = -1000f;
     this.blink             = 1f;
 }
Example #2
0
        public MUIBox(MultiplayerHUD owner, Vector2 pos, Vector2 size)
        {
            this.pos          = pos;
            this.owner        = owner;
            this.longestLineX = (int)size.x;
            this.numberLines  = 1;
            this.InitiateSprites();

            drawSize = size;
        }
Example #3
0
        //public Vector2 pos;

        public MUILabel(MultiplayerHUD owner, string labelName, Color color, Vector2 pos)
        {
            this.owner       = owner;
            this.label       = new FLabel("font", labelName);
            this.color       = color;
            this.label.color = color;
            this.owner.frontContainer.AddChild(this.label);
            this.label.alpha = 0f;
            this.label.x     = -1000f;
            this.pos         = pos;
        }
Example #4
0
        public MUIBox(MultiplayerHUD owner, Vector2 pos, int longestLineX, int numberLines)
        {
            //this.messages = new List<DialogBox.Message>();
            this.pos          = pos;
            this.owner        = owner;
            this.longestLineX = longestLineX;
            this.numberLines  = numberLines;
            this.InitiateSprites();

            drawSize   = new Vector2(0f, 0);
            drawSize.x = MUIBox.widthMargin + (float)this.longestLineX + MUIBox.widthMargin;  //* MUIBox.meanCharWidth;
            drawSize.y = MUIBox.heightMargin + MUIBox.lineHeight * (float)this.numberLines;
        }
Example #5
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);
        }
Example #6
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++;
            }
        }