static public void Label(ref CuiElementContainer container, string panel, string text, int size, UI4 dimensions, TextAnchor align = TextAnchor.MiddleCenter)
 {
     container.Add(new CuiLabel
     {
         Text          = { FontSize = size, Align = align, Text = text, Font = "droidsansmono.ttf" },
         RectTransform = { AnchorMin = dimensions.GetMin(), AnchorMax = dimensions.GetMax() }
     },
                   panel);
 }
            static public CuiElementContainer ElementContainer(string panelName, string color, UI4 dimensions, bool useCursor = false, string parent = "Overlay")
            {
                var NewElement = new CuiElementContainer()
                {
                    {
                        new CuiPanel
                        {
                            Image         = { Color = color },
                            RectTransform = { AnchorMin = dimensions.GetMin(), AnchorMax = dimensions.GetMax() },
                            CursorEnabled = useCursor
                        },
                        new CuiElement().Parent = parent,
                        panelName
                    }
                };

                return(NewElement);
            }
 static public void Panel(ref CuiElementContainer container, string panel, string color, UI4 dimensions, bool cursor = false)
 {
     container.Add(new CuiPanel
     {
         Image         = { Color = color },
         RectTransform = { AnchorMin = dimensions.GetMin(), AnchorMax = dimensions.GetMax() },
         CursorEnabled = cursor
     },
                   panel);
 }
Example #4
0
    public bool labeled = false; //Whether or not stuff is labeled

    //Labels the UI with the proper owner
    public void labelUI()
    {
        team1 = processing.GetComponent <combatGlobals>().team1;
        team2 = processing.GetComponent <combatGlobals>().team2;

        int team1Size = team1.Count;
        int team2Size = team2.Count;

        //distribute team 1's slots andsending out their initial dragons
        if (team1Size == 1)
        {
            UI1.GetComponent <UIControl>().owner = team1[0].name;
            dragon1.GetComponent <dragonControl>().changeDragon(team1[0].dragon1);
            UI2.GetComponent <UIControl>().owner = team1[0].name;
            dragon2.GetComponent <dragonControl>().changeDragon(team1[0].dragon2);
            UI3.GetComponent <UIControl>().owner = team1[0].name;
            dragon3.GetComponent <dragonControl>().changeDragon(team1[0].dragon3);
            UI4.GetComponent <UIControl>().owner = team1[0].name;
            dragon4.GetComponent <dragonControl>().changeDragon(team1[0].dragon4);

            team1[0].dragon1.inUse = true;
            team1[0].dragon2.inUse = true;
            team1[0].dragon3.inUse = true;
            team1[0].dragon4.inUse = true;

            switchDragons(1, team1[0].dragon1);
            switchDragons(2, team1[0].dragon2);
            switchDragons(3, team1[0].dragon3);
            switchDragons(4, team1[0].dragon4);
        }
        else if (team1Size == 2)
        {
            UI1.GetComponent <UIControl>().owner = team1[0].name;
            dragon1.GetComponent <dragonControl>().changeDragon(team1[0].dragon1);
            UI2.GetComponent <UIControl>().owner = team1[0].name;
            dragon2.GetComponent <dragonControl>().changeDragon(team1[0].dragon2);
            UI3.GetComponent <UIControl>().owner = team1[1].name;
            dragon3.GetComponent <dragonControl>().changeDragon(team1[1].dragon1);
            UI4.GetComponent <UIControl>().owner = team1[1].name;
            dragon4.GetComponent <dragonControl>().changeDragon(team1[1].dragon2);

            team1[0].dragon1.inUse = true;
            team1[0].dragon2.inUse = true;
            team1[1].dragon1.inUse = true;
            team1[1].dragon2.inUse = true;

            switchDragons(1, team1[0].dragon1);
            switchDragons(2, team1[0].dragon2);
            switchDragons(3, team1[1].dragon1);
            switchDragons(4, team1[1].dragon2);
        }
        else if (team1Size == 3)
        {
            UI1.GetComponent <UIControl>().owner = team1[0].name;
            dragon1.GetComponent <dragonControl>().changeDragon(team1[0].dragon1);
            UI2.GetComponent <UIControl>().owner = team1[1].name;
            dragon2.GetComponent <dragonControl>().changeDragon(team1[1].dragon1);
            UI3.GetComponent <UIControl>().owner = team1[1].name;
            dragon3.GetComponent <dragonControl>().changeDragon(team1[1].dragon2);
            UI4.GetComponent <UIControl>().owner = team1[2].name;
            dragon4.GetComponent <dragonControl>().changeDragon(team1[2].dragon1);

            team1[0].dragon1.inUse = true;
            team1[1].dragon1.inUse = true;
            team1[1].dragon2.inUse = true;
            team1[2].dragon1.inUse = true;

            switchDragons(1, team1[0].dragon1);
            switchDragons(2, team1[1].dragon1);
            switchDragons(3, team1[1].dragon2);
            switchDragons(4, team1[2].dragon1);
        }
        else if (team1Size == 4)
        {
            UI1.GetComponent <UIControl>().owner = team1[0].name;
            dragon1.GetComponent <dragonControl>().changeDragon(team1[0].dragon1);
            UI2.GetComponent <UIControl>().owner = team1[1].name;
            dragon2.GetComponent <dragonControl>().changeDragon(team1[1].dragon1);
            UI3.GetComponent <UIControl>().owner = team1[2].name;
            dragon3.GetComponent <dragonControl>().changeDragon(team1[2].dragon1);
            UI4.GetComponent <UIControl>().owner = team1[3].name;
            dragon4.GetComponent <dragonControl>().changeDragon(team1[3].dragon1);

            team1[0].dragon1.inUse = true;
            team1[1].dragon1.inUse = true;
            team1[2].dragon1.inUse = true;
            team1[3].dragon1.inUse = true;

            switchDragons(1, team1[0].dragon1);
            switchDragons(2, team1[1].dragon1);
            switchDragons(3, team1[2].dragon1);
            switchDragons(4, team1[3].dragon1);
        }

        //distribute team 2's slots
        if (team2Size == 1)
        {
            UI5.GetComponent <UIControl>().owner = team2[0].name;
            dragon5.GetComponent <dragonControl>().changeDragon(team2[0].dragon1);
            UI6.GetComponent <UIControl>().owner = team2[0].name;
            dragon6.GetComponent <dragonControl>().changeDragon(team2[0].dragon2);
            UI7.GetComponent <UIControl>().owner = team2[0].name;
            dragon7.GetComponent <dragonControl>().changeDragon(team2[0].dragon3);
            UI8.GetComponent <UIControl>().owner = team2[0].name;
            dragon8.GetComponent <dragonControl>().changeDragon(team2[0].dragon4);

            team2[0].dragon1.inUse = true;
            team2[0].dragon2.inUse = true;
            team2[0].dragon3.inUse = true;
            team2[0].dragon4.inUse = true;

            switchDragons(5, team2[0].dragon1);
            switchDragons(6, team2[0].dragon2);
            switchDragons(7, team2[0].dragon3);
            switchDragons(8, team2[0].dragon4);
        }
        else if (team2Size == 2)
        {
            UI5.GetComponent <UIControl>().owner = team2[0].name;
            dragon5.GetComponent <dragonControl>().changeDragon(team2[0].dragon1);
            UI6.GetComponent <UIControl>().owner = team2[0].name;
            dragon6.GetComponent <dragonControl>().changeDragon(team2[0].dragon2);
            UI7.GetComponent <UIControl>().owner = team2[1].name;
            dragon7.GetComponent <dragonControl>().changeDragon(team2[1].dragon1);
            UI8.GetComponent <UIControl>().owner = team2[1].name;
            dragon8.GetComponent <dragonControl>().changeDragon(team2[1].dragon2);

            team2[0].dragon1.inUse = true;
            team2[0].dragon2.inUse = true;
            team2[1].dragon1.inUse = true;
            team2[1].dragon2.inUse = true;

            switchDragons(5, team2[0].dragon1);
            switchDragons(6, team2[0].dragon2);
            switchDragons(7, team2[1].dragon1);
            switchDragons(8, team2[1].dragon2);
        }
        else if (team2Size == 3)
        {
            UI5.GetComponent <UIControl>().owner = team2[0].name;
            dragon5.GetComponent <dragonControl>().changeDragon(team2[0].dragon1);
            UI6.GetComponent <UIControl>().owner = team2[1].name;
            dragon6.GetComponent <dragonControl>().changeDragon(team2[1].dragon1);
            UI7.GetComponent <UIControl>().owner = team2[1].name;
            dragon7.GetComponent <dragonControl>().changeDragon(team2[1].dragon2);
            UI8.GetComponent <UIControl>().owner = team2[2].name;
            dragon8.GetComponent <dragonControl>().changeDragon(team2[2].dragon1);

            team2[0].dragon1.inUse = true;
            team2[1].dragon1.inUse = true;
            team2[1].dragon2.inUse = true;
            team2[2].dragon1.inUse = true;

            switchDragons(5, team2[0].dragon1);
            switchDragons(6, team2[1].dragon1);
            switchDragons(7, team2[1].dragon2);
            switchDragons(8, team2[2].dragon1);
        }
        else if (team2Size == 4)
        {
            UI5.GetComponent <UIControl>().owner = team2[0].name;
            dragon5.GetComponent <dragonControl>().changeDragon(team2[0].dragon1);
            UI6.GetComponent <UIControl>().owner = team2[1].name;
            dragon6.GetComponent <dragonControl>().changeDragon(team2[1].dragon1);
            UI7.GetComponent <UIControl>().owner = team2[2].name;
            dragon7.GetComponent <dragonControl>().changeDragon(team2[2].dragon1);
            UI8.GetComponent <UIControl>().owner = team2[3].name;
            dragon8.GetComponent <dragonControl>().changeDragon(team2[3].dragon1);

            team2[0].dragon1.inUse = true;
            team2[1].dragon1.inUse = true;
            team2[2].dragon1.inUse = true;
            team2[3].dragon1.inUse = true;

            switchDragons(5, team2[0].dragon1);
            switchDragons(6, team2[1].dragon1);
            switchDragons(7, team2[2].dragon1);
            switchDragons(8, team2[3].dragon1);
        }
    }