Inheritance: MonoBehaviour
Ejemplo n.º 1
0
        public void AddModel(Nameplate model)
        {
            using (var cn = new SqlConnection())
            {
                cn.ConnectionString = ConfigurationManager
                                      .ConnectionStrings["GuildCars"]
                                      .ConnectionString;

                var parameters = new DynamicParameters();
                parameters.Add("@NameplateId", model.NameplateId, DbType.Int32, ParameterDirection.Output);
                parameters.Add("@ManufacturerId", model.ManufacturerId);
                parameters.Add("@NameplateMarque", model.NameplateMarque);
                parameters.Add("@BodyStyle", model.BodyStyle);
                parameters.Add("@DateAdded", model.DateAdded);
                parameters.Add("@Username", model.Username);

                cn.Execute(
                    "CreateNameplate",
                    parameters,
                    commandType: CommandType.StoredProcedure);

                model.NameplateId = parameters.Get <int>("@NameplateId");

                cn.Close();
            }
        }
Ejemplo n.º 2
0
        public void UpdateNameplatePosition()
        {
            lock (nameplateList)
            {
                if (nameplateList.Count == 0)
                {
                    return;
                }

                //Updating selected index
                startingRenderingIndex = Math.Max(selectedIndex - maximumRenderableLines + 1, 0);
                finalRenderingIndex    = Math.Min(startingRenderingIndex + maximumRenderableLines, nameplateList.Count);

                Vector2 startingPosition = background.Position.ToIntegerDomain() + (elementYOffset / 2).ToIntegerDomain();

                for (int i = startingRenderingIndex; i < finalRenderingIndex; i++)
                {
                    Nameplate nmp = nameplateList[i];
                    nmp.Update(startingPosition + (i - startingRenderingIndex) * elementYOffset);
                    nmp.ResetTextColor();
                }

                nameplateList[selectedIndex].ReplaceTextColor(nameplateList[selectedIndex].PlayerColor, Color.White);
            }
        }
Ejemplo n.º 3
0
        private void AppendPlayersToTable(List <Player> team, Vector2 position, bool isTeamRed)
        {
            for (int i = 0; i < team.Count(); i++)
            {
                Vector2 center = position + new Vector2(0, -70) + new Vector2(0, 54) * i;

                Player p = team[i];

                //Nameplate
                Nameplate nmp = new Nameplate(p, Alignment.Left, center - new Vector2(135, 10), false, DepthParameter.InterfacePopupText);
                nameplateList.Add(nmp);

                //Team Frame
                //If you are the player
                if (GameInformation.Instance.PlayerInformation.ID == p.ID)
                {
                    Sprite teamMarker = new Sprite("Interface/Popup/Blue/Results/TeamMarker", center - new Vector2(140, 0), DepthParameter.InterfacePopupButtons, new Rectangle(46 * (isTeamRed ? 1 : 3), 0, 46, 47))
                    {
                        Pivot = new Vector2(46 / 2, 47 / 2),
                    };
                    spriteList.Add(teamMarker);

                    spriteList.Add(new Sprite("Interface/Popup/Blue/Results/PlayerFrame", center, DepthParameter.InterfacePopupForeground));
                }
                else
                {
                    Sprite teamMarker = new Sprite("Interface/Popup/Blue/Results/TeamMarker", center - new Vector2(140, 0), DepthParameter.InterfacePopupButtons, new Rectangle(46 * (isTeamRed ? 0 : 2), 0, 46, 47))
                    {
                        Pivot = new Vector2(46 / 2, 47 / 2),
                    };
                    spriteList.Add(teamMarker);
                }
            }
        }
Ejemplo n.º 4
0
        public int frozenFrame = 0;             // The frame that the character is frozen until (after resets, etc).

        public Character(RoomScene room, byte subType, FVector pos, Dictionary <string, short> paramList) : base(room, subType, pos, paramList)
        {
            this.Meta = Systems.mapper.ObjectMetaData[(byte)ObjectEnum.Character].meta;

            this.SetSpriteName("Stand");

            // Physics, Collisions, etc.
            this.AssignBounds(8, 12, 28, 44);
            this.physics = new Physics(this);
            this.physics.SetGravity(FInt.Create(0.7));

            // Default Stats & Statuses
            this.stats  = new CharacterStats(this);
            this.status = new CharacterStatus();
            this.wounds = new CharacterWounds(this);

            // Attachments
            this.trailKeys  = new TrailingKeys(this);
            this.heldItem   = new HeldItem(this);
            this.magiShield = new MagiShield(this);
            this.nameplate  = new Nameplate(this, "Lana", false, false);

            // Images and Animations
            this.animate = new Animate(this, "/");

            // Reset Character, Set Default Values
            this.ResetCharacter();

            // Assign SubTypes and Params
            this.AssignSubType(subType);
            this.AssignParams(paramList);
        }
Ejemplo n.º 5
0
        public static void OnNameplateRemoved(Nameplate nameplate, ExEntityLink link)
        {
            NameplateHook hook = link.GetComponent <NameplateHook>();

            if (hook != null)
            {
                NameplateHook.Destroy(hook);
            }
        }
Ejemplo n.º 6
0
    public void ShowNameplate(GameActor.Alignment charType)
    {
        Debug.Assert(Nameplate == null, "showing already shown nameplate");

        GameObject nameplateGO = Instantiate(NameplateUI);

        Nameplate = nameplateGO.GetComponent <Nameplate>();
        Nameplate.transform.SetParent(UIParent.transform, false);
    }
Ejemplo n.º 7
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    public void Destroy(Nameplate n)
    {
        if (n != null)
        {
            m_nameplates.Remove(n);

            GameObject.Destroy(n.gameObject);
        }
    }
Ejemplo n.º 8
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    public Nameplate Create(GameObject anchor, Vector3 Offset)
    {
        GameObject instance = new GameObject("Nameplate", new System.Type[] { typeof(Nameplate), typeof(UnityEngine.UI.Text), typeof(UnityEngine.UI.Shadow) });

        instance.transform.SetParent(transform, false);

        instance.transform.localPosition = Vector3.zero;

        instance.transform.localScale = Vector3.one;

        instance.transform.localRotation = Quaternion.identity;


        Nameplate nameplate = instance.GetComponent <Nameplate>();

        nameplate.m_transform = instance.GetComponent <RectTransform>();

        nameplate.m_text = instance.GetComponent <UnityEngine.UI.Text>();

        nameplate.m_shadow = instance.GetComponent <UnityEngine.UI.Shadow>();

        nameplate.m_anchor = anchor;


        if (nameplate != null)
        {
            nameplate.m_Offset = Offset;
        }

        if (nameplate.m_transform != null)
        {
            nameplate.m_transform.sizeDelta = new Vector2(256.0f, 32.0f);
        }

        if (nameplate.m_text != null)
        {
            nameplate.m_text.font = m_font; nameplate.m_text.alignment = TextAnchor.MiddleCenter;
        }

        if (nameplate.m_shadow != null)
        {
            nameplate.m_shadow.effectDistance = new Vector2(-1.0f, 1.0f); nameplate.m_shadow.effectColor = new Color(0.0f, 0.0f, 0.0f, 1.0f);
        }


        m_nameplates.Add(nameplate);

        return(nameplate);
    }
Ejemplo n.º 9
0
        public PlayerButton(Player Player, Action <object> OnClick, Vector2 ButtonOffset)
            : base(ButtonType.PlayerButton, DepthParameter.InterfaceButton, OnClick, ButtonOffset)
        {
            //Hide button placeholder
            spriteList   = new List <Sprite>();
            flipbookList = new List <Flipbook>();

            ButtonSprite.Color = Color.Transparent;
            this.Player        = Player;

            //Since the button elements dont update, the screencenter
            //must be added in order to create the right position
            //on the elements
            ButtonOffset += Parameter.ScreenCenter;

            int sidePositionFactor = (Player.PlayerTeam == PlayerTeam.Red) ? 1 : -1;

            PlayerStatus = new Flipbook(
                ButtonOffset + new Vector2(82 * sidePositionFactor, 0),
                new Vector2((296 / 4) / 2, 76 / 2),
                74, 76, "Interface/StaticButtons/GameRoom/Player/StatusMarker",
                PlayerStatusPreset[Player.PlayerTeam][Player.PlayerRoomStatus],
                DepthParameter.InterfaceButtonIcon);
            flipbookList.Add(PlayerStatus);

            PlayerStatusText = new Flipbook(
                ButtonOffset + new Vector2(78 * sidePositionFactor, 28),
                new Vector2((150 / 3) / 2, 16 / 2),
                50, 16, "Interface/StaticButtons/GameRoom/Player/StatusText",
                PlayerStatusTextPreset[Player.PlayerTeam][Player.PlayerRoomStatus],
                DepthParameter.InterfaceButtonText);
            flipbookList.Add(PlayerStatusText);

            spriteList.Add(new Sprite("Interface/StaticButtons/GameRoom/Player/Shadow",
                                      ButtonOffset + new Vector2(-20 * sidePositionFactor, 33),
                                      DepthParameter.Mobile - 0.01f));

            Mobile = ActorBuilder.BuildMobile(Player.PrimaryMobile, Player, ButtonOffset + new Vector2(-20 * sidePositionFactor, 7), false);
            Mobile.Rider.Update();

            if (Player.PlayerTeam == PlayerTeam.Red)
            {
                Mobile.Flip();
            }

            Nameplate = new Nameplate(Player, Alignment.Left, ButtonOffset - new Vector2(100, 47));

            Mobile.MobileFlipbook.JumpToRandomAnimationFrame();
        }
Ejemplo n.º 10
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    public void UpdateNameplate(Nameplate n)
    {
        n.gameObject.SetActive(n.m_anchor.activeInHierarchy);

        if (n.gameObject.activeInHierarchy)
        {
            Vector2 s = Vector2.zero;

            Vector2 p = RectTransformUtility.WorldToScreenPoint(Camera.main, n.m_anchor.transform.localPosition + n.m_Offset);

            RectTransformUtility.ScreenPointToLocalPointInRectangle(m_transform, p, null, out s);

            n.m_transform.localPosition = new Vector3(s.x, s.y, 100.0f);
        }
    }
Ejemplo n.º 11
0
        public static void OnNameplateChanged(Nameplate nameplate, ExEntityLink link)
        {
            NameplateHook hook = link.Require <NameplateHook>();

            if (hook.name3d == null)
            {
                var prefab = Resources.Load <TextMeshPro>("Nameplate");
                hook.name3d = Instantiate(prefab, hook.transform.position, hook.transform.rotation);
                hook.name3d.transform.SetParent(hook.transform);
            }

            if (hook.nname != nameplate.name)
            {
                hook.nname       = nameplate.name;
                hook.name3d.text = hook.nname;
            }
        }
Ejemplo n.º 12
0
 // Token: 0x06001425 RID: 5157 RVA: 0x00056208 File Offset: 0x00054408
 private void SetupIndicator()
 {
     if (this.indicator)
     {
         return;
     }
     if (this.body)
     {
         CharacterMaster master     = this.body.master;
         bool            flag       = master && master.isBoss;
         GameObject      gameObject = null;
         if (master && this.teamIndex == TeamIndex.Player)
         {
             gameObject = Resources.Load <GameObject>(this.body.isPlayerControlled ? "Prefabs/PositionIndicators/PlayerPositionIndicator" : "Prefabs/PositionIndicators/NPCPositionIndicator");
         }
         else if (flag)
         {
             gameObject = Resources.Load <GameObject>("Prefabs/PositionIndicators/BossPositionIndicator");
         }
         if (this.indicator)
         {
             UnityEngine.Object.Destroy(this.indicator);
             this.indicator = null;
         }
         if (gameObject)
         {
             this.indicator = UnityEngine.Object.Instantiate <GameObject>(gameObject, base.transform);
             this.indicator.GetComponent <PositionIndicator>().targetTransform = this.body.coreTransform;
             Nameplate component = this.indicator.GetComponent <Nameplate>();
             if (component)
             {
                 component.SetBody(this.body);
             }
         }
     }
 }
Ejemplo n.º 13
0
        public AttributeMenu(Vector2 basePosition, Player player)
        {
            this.basePosition = basePosition;

            numericSpriteFontList          = new List <NumericSpriteFont>();
            attributeNumericSpriteFontList = new List <NumericSpriteFont>();
            buttonList                = new List <Button>();
            addAttributeButtonList    = new List <Button>();
            removeAttributeButtonList = new List <Button>();

            attributes = GameInformation.Instance.PlayerInformation.Attribute;

            //Nameplates
            nameplate = new Nameplate(player, Alignment.Left, basePosition + new Vector2(15, 43));

            //Gold/Cash
            goldSpriteText          = new SpriteText(FontTextType.Consolas10, "", Parameter.InterfaceAvatarShopButtonGoldColor, Alignment.Right, DepthParameter.InterfaceButton, basePosition, Parameter.InterfaceAvatarShopButtonGoldOutlineColor);
            goldSpriteText.Position = basePosition + new Vector2(192, 133);
            goldIcon = new Sprite("Interface/StaticButtons/AvatarShop/AvatarButton/GoldIcon",
                                  basePosition + new Vector2(202, 138), DepthParameter.InterfaceButton, new Rectangle(0, 0, 26, 21));
            goldIcon.Pivot  = new Vector2(13, 10.5f);
            goldIcon.Scale /= 2;

            cashSpriteText          = new SpriteText(FontTextType.Consolas10, "", Parameter.InterfaceAvatarShopButtonCashColor, Alignment.Right, DepthParameter.InterfaceButton, basePosition, Parameter.InterfaceAvatarShopButtonCashOutlineColor);
            cashSpriteText.Position = basePosition + new Vector2(192, 152);
            cashIcon = new Sprite("Interface/StaticButtons/AvatarShop/AvatarButton/CashIcon",
                                  basePosition + new Vector2(202, 157), DepthParameter.InterfaceButton, new Rectangle(0, 0, 26, 21));
            cashIcon.Pivot  = new Vector2(13, 10.5f);
            cashIcon.Scale /= 2;

            //Confirm/Cancel points
            accept = new Button(ButtonType.Accept, DepthParameter.InterfaceButton, AcceptChangesAction, -new Vector2(362, 182));
            cancel = new Button(ButtonType.Cancel, DepthParameter.InterfaceButton, CancelChangesAction, -new Vector2(332, 182));
            accept.ButtonSprite.Scale = cancel.ButtonSprite.Scale *= 3f / 4f;

            cancel.Disable();
            accept.Disable();

            //Remaining Points
            remainingPointsSpriteTextList =
                new List <SpriteText>()
            {
                new SpriteText(FontTextType.Consolas10, "Remaining", Color.White, Alignment.Center, DepthParameter.InterfaceButtonText, outlineColor: Color.Black),
                new SpriteText(FontTextType.Consolas10, "Points", Color.White, Alignment.Center, DepthParameter.InterfaceButtonText, outlineColor: Color.Black),
            };

            remainingPointsSpriteTextList[0].Position = basePosition + new Vector2(53, 60);
            remainingPointsSpriteTextList[1].Position = basePosition + new Vector2(53, 75);

            //Calculate remaining points
            remainingPoints = GameInformation.Instance.PlayerInformation.GetCurrentAttributePoints() - attributes.ToList().Sum();

            remaningPointsNumericSpriteFont = new NumericSpriteFont(FontType.AvatarShopStatusCounter, 3, DepthParameter.InterfaceButton,
                                                                    PositionOffset: new Vector2(-356, -210),
                                                                    StartingValue: remainingPoints,
                                                                    forceRendingAllNumbers: true);

            numericSpriteFontList.Add(remaningPointsNumericSpriteFont);

            //Attribute Points
            AddAttributePoints();

            RefreshCurrencyValues();

            buttonList.Add(accept);
            buttonList.Add(cancel);
        }
Ejemplo n.º 14
0
        // Token: 0x0600162E RID: 5678 RVA: 0x0006A288 File Offset: 0x00068488
        private void SetupIndicator()
        {
            if (this.indicator)
            {
                return;
            }
            CharacterBody component = base.GetComponent <CharacterBody>();

            if (component)
            {
                TeamComponent component2 = component.GetComponent <TeamComponent>();
                if (component2)
                {
                    CharacterMaster master     = component.master;
                    bool            flag       = master && master.isBoss;
                    GameObject      gameObject = null;
                    if (master && component2.teamIndex == TeamIndex.Player)
                    {
                        bool flag2 = false;
                        PlayerCharacterMasterController component3 = master.GetComponent <PlayerCharacterMasterController>();
                        if (component3)
                        {
                            flag2 = true;
                            GameObject networkUserObject = component3.networkUserObject;
                            if (networkUserObject)
                            {
                                NetworkIdentity component4 = networkUserObject.GetComponent <NetworkIdentity>();
                                if (component4)
                                {
                                    bool isLocalPlayer = component4.isLocalPlayer;
                                }
                            }
                        }
                        Vector3 position = component.transform.position;
                        component.GetComponent <Collider>();
                        if (flag2)
                        {
                            gameObject = Resources.Load <GameObject>("Prefabs/PositionIndicators/PlayerPositionIndicator");
                        }
                        else
                        {
                            gameObject = Resources.Load <GameObject>("Prefabs/PositionIndicators/NPCPositionIndicator");
                        }
                        this.indicator = UnityEngine.Object.Instantiate <GameObject>(gameObject, position, Quaternion.identity, component.transform);
                    }
                    else if (flag)
                    {
                        gameObject = Resources.Load <GameObject>("Prefabs/PositionIndicators/BossPositionIndicator");
                    }
                    if (this.indicator)
                    {
                        UnityEngine.Object.Destroy(this.indicator);
                        this.indicator = null;
                    }
                    if (gameObject)
                    {
                        this.indicator = UnityEngine.Object.Instantiate <GameObject>(gameObject, base.transform);
                        this.indicator.GetComponent <PositionIndicator>().targetTransform = component.coreTransform;
                        Nameplate component5 = this.indicator.GetComponent <Nameplate>();
                        if (component5)
                        {
                            component5.SetBody(component);
                        }
                    }
                }
            }
        }