Example #1
0
    public void RefreshPlayerHpBar()
    {
        TextNameBehavior nameBehavoir = GetBehavior <TextNameBehavior>();

        if (nameBehavoir == null)
        {
            return;
        }
        UI3DText.StyleInfo info = nameBehavoir.DataStyleInfo;
        if (info == null)
        {
            return;
        }

        // 和平模式(且没有锁定的攻击敌人),不显示血条,破碎死域副本内要总是显示血条
        if (PKModeManagerEx.Instance.CanShowPVPBlood(this) == false && SceneHelp.Instance.ForceShowHpBar == false)
        {
            SetShowBar(info, false);
        }
        else
        {
            SetShowBar(info, true);
        }

        nameBehavoir.RefreshStyle();
    }
Example #2
0
        public void Init(int id, uint excelId)
        {
            List <Dictionary <string, string> > dbs = DBManager.Instance.QuerySqliteRow <string>(GlobalConfig.DBFile, "data_collection", "id", excelId.ToString());

            if (dbs.Count > 0)
            {
                mDBConfig = dbs[0];
                // 帮派BOSS火把
                mGuildBossFireComponent = null;
                if (mDBConfig["class"] == "guild_boss_fire")
                {
                    mGuildBossFireComponent = gameObject.AddComponent <GuildBossFireComponent>();
                    mGuildBossFireComponent.Init((uint)id);
                }

                UpdateModel();

                var collectionObjectBehaviour = gameObject.AddComponent <CollectionObjectBehaviour>();
                collectionObjectBehaviour.Init((uint)id, excelId);

                // 头顶名字
                if (string.IsNullOrEmpty(mDBConfig["head_name"]) == false)
                {
                    UI3DText           textComponent = gameObject.AddComponent <UI3DText>();
                    UI3DText.StyleInfo styleInfo     = new UI3DText.StyleInfo();
                    styleInfo.Offset = DBTextResource.ParseVector3(mDBConfig["head_name_pos_offset"]);
                    textComponent.ResetStyleInfo(styleInfo);
                    textComponent.Text = mDBConfig["head_name"];
                }
            }

            ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_SETTING_QUALITY_CHANGED, OnSettingQualityChanged);
        }
Example #3
0
        static int _g_get_Offset(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

            try {
                UI3DText.StyleInfo __cl_gen_to_be_invoked = (UI3DText.StyleInfo)translator.FastGetCSObj(L, 1);
                translator.PushUnityEngineVector3(L, __cl_gen_to_be_invoked.Offset);
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            return(1);
        }
Example #4
0
        static int _s_set_LayoutIsVisiable(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

            try {
                UI3DText.StyleInfo __cl_gen_to_be_invoked = (UI3DText.StyleInfo)translator.FastGetCSObj(L, 1);
                __cl_gen_to_be_invoked.LayoutIsVisiable = LuaAPI.lua_toboolean(L, 2);
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            return(0);
        }
Example #5
0
        static int _s_set_SpriteHeight(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

            try {
                UI3DText.StyleInfo __cl_gen_to_be_invoked = (UI3DText.StyleInfo)translator.FastGetCSObj(L, 1);
                __cl_gen_to_be_invoked.SpriteHeight = LuaAPI.xlua_tointeger(L, 2);
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            return(0);
        }
Example #6
0
        static int _g_get_IsEnemyRelation(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

            try {
                UI3DText.StyleInfo __cl_gen_to_be_invoked = (UI3DText.StyleInfo)translator.FastGetCSObj(L, 1);
                LuaAPI.lua_pushboolean(L, __cl_gen_to_be_invoked.IsEnemyRelation);
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            return(1);
        }
Example #7
0
        static int _s_set_BgPreHeadOffset(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

            try {
                UI3DText.StyleInfo  __cl_gen_to_be_invoked = (UI3DText.StyleInfo)translator.FastGetCSObj(L, 1);
                UnityEngine.Vector3 __cl_gen_value; translator.Get(L, 2, out __cl_gen_value);
                __cl_gen_to_be_invoked.BgPreHeadOffset = __cl_gen_value;
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            return(0);
        }
Example #8
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="data"></param>
        public OrdinaryObjectObject(Neptune.OrdinaryObject data)
            : base(data)
        {
            mLoadPrefabCoroutine = LevelObjectHelper.SetObjectPrefab(gameObject, data.PrefabInfo);

            // 头顶名字
            if (string.IsNullOrEmpty(data.HeadName) == false)
            {
                UI3DText           textComponent = gameObject.AddComponent <UI3DText>();
                UI3DText.StyleInfo styleInfo     = new UI3DText.StyleInfo();
                styleInfo.Offset = data.HeadNamePosOffset;
                textComponent.ResetStyleInfo(styleInfo);
                var str = xc.TextHelper.GetTranslateText(data.HeadName);
                textComponent.Text = str;
            }
        }
Example #9
0
        static int __CreateInstance(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

            try {
                if (LuaAPI.lua_gettop(L) == 1)
                {
                    UI3DText.StyleInfo __cl_gen_ret = new UI3DText.StyleInfo();
                    translator.Push(L, __cl_gen_ret);
                    return(1);
                }
            }
            catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to UI3DText.StyleInfo constructor!"));
        }
Example #10
0
    public void SetShowBar(UI3DText.StyleInfo info, bool is_show_bar)
    {
        info.IsShowBar = is_show_bar;

        if (this.IsLocalPlayer)
        {
            info.HpBarName = UI3DText.LocalPlayerHpName;
        }
        else
        {
            if (info.IsEnemyRelation == false)//队友
            {
                info.HpBarName = UI3DText.FriendHpName;
            }
            else
            {//敌人
                info.HpBarName = UI3DText.EnemyHpName;
            }
        }
    }
Example #11
0
        static int _m_SetShowBar(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            Player __cl_gen_to_be_invoked = (Player)translator.FastGetCSObj(L, 1);


            try {
                {
                    UI3DText.StyleInfo info = (UI3DText.StyleInfo)translator.GetObject(L, 2, typeof(UI3DText.StyleInfo));
                    bool is_show_bar        = LuaAPI.lua_toboolean(L, 3);

                    __cl_gen_to_be_invoked.SetShowBar(info, is_show_bar);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Example #12
0
 public void SetStyle(UI3DText.StyleInfo style_info)
 {
     m_StyleInfo = style_info;
     if (mNameComponent != null)
     {
         if (style_info.IsShowBar || style_info.IsShowBg || style_info.IsShowBgPreHead)
         {
             DBInstance.InstanceInfo instanceInfo = InstanceManager.Instance.InstanceInfo;
             if (instanceInfo != null)
             {
                 if (DBInstanceTypeControl.Instance.HideHpBar(instanceInfo.mWarType, instanceInfo.mWarSubType))
                 {
                     style_info.IsShowBar = false;
                 }
                 if (DBInstanceTypeControl.Instance.HideCamp(instanceInfo.mWarType, instanceInfo.mWarSubType))
                 {
                     style_info.IsShowBg        = false;
                     style_info.IsShowBgPreHead = false;
                 }
             }
         }
         mNameComponent.ResetStyleInfo(style_info, mOwner);
     }
 }
        void OnModelChange(CEventBaseArgs param)
        {
            WorshipModel owner = mOwner as WorshipModel;

            if (owner == null)
            {
                return;
            }

            // 头顶名字
            if (mTextComponent != null)
            {
                UnityEngine.Object.DestroyImmediate(mTextComponent);
            }
            mTextComponent = mOwner.GetModelParent().AddComponent <UI3DText>();
            UI3DText.StyleInfo styleInfo = new UI3DText.StyleInfo();
            float modelScale             = GameConstHelper.GetFloat("GAME_DUNGEON_WORSHIP_MODEL_SCALE");

            styleInfo.HeadOffset   = new Vector3(0f, mOwner.Height * modelScale, 0f);
            styleInfo.ScreenOffset = UI3DText.NameTextScreenOffset * modelScale;
            mTextComponent.SetHeadTrans(mOwner.GetModelParent().transform);
            mTextComponent.ResetStyleInfo(styleInfo);
            string text = "<color=#ffc319>" + owner.Rank.ToString();

            if (owner.Rank == 1)
            {
                text = text + DBConstText.GetText("ANSWER_WORSHIP_1"); // "st雕像";
            }
            else if (owner.Rank == 2)
            {
                text = text + DBConstText.GetText("ANSWER_WORSHIP_2");  //"nd雕像";
            }
            else if (owner.Rank == 3)
            {
                text = text + DBConstText.GetText("ANSWER_WORSHIP_3");  //"rd雕像";
            }
            else
            {
                text = text + DBConstText.GetText("ANSWER_WORSHIP_4");  //"th雕像";
            }
            text = text + "</color>";
            mTextComponent.RankTextLabel = text;
            mTextComponent.FontSize      = 22;
            if (string.IsNullOrEmpty(owner.GuildName) == false)
            {
                mTextComponent.GuildNameTextLabel = "<color=#4ef269><" + owner.GuildName + "></color>";
            }
            mTextComponent.Text = "<color=#5ec4ff>" + owner.UserName + "</color>";

            // 膜拜按钮
            if (mWorshipButtonComponent != null)
            {
                UnityEngine.Object.DestroyImmediate(mWorshipButtonComponent);
            }
            mWorshipButtonComponent = mOwner.GetModelParent().AddComponent <UI3DText>();
            styleInfo              = new UI3DText.StyleInfo();
            modelScale             = GameConstHelper.GetFloat("GAME_DUNGEON_WORSHIP_MODEL_SCALE");
            styleInfo.HeadOffset   = Vector3.zero;
            styleInfo.ScreenOffset = Vector3.zero;
            mWorshipButtonComponent.SetHeadTrans(ModelHelper.FindChildInHierarchy(mOwner.GetModelParent().transform, "root_node"));
            mWorshipButtonComponent.ResetStyleInfo(styleInfo);
            mWorshipButtonComponent.SetButtonStyle("MainWindow_New@Chatting@Praisebtn", DBConstText.GetText("WORSHIP"), 24, new Color(0.2f, 0.2f, 0.2f), new Vector3(0f, -9f, 0f));
            UnityEngine.UI.Image buttonImage = mWorshipButtonComponent.ButtonImage;
            if (buttonImage != null)
            {
                buttonImage.sprite = mWorshipButtonComponent.LoadSprite("MainWindow_New@Chatting@Hands");
                buttonImage.SetNativeSize();
                buttonImage.transform.localPosition = new Vector3(75, 40, 0);
                xc.ui.ugui.TweenPosition tween = xc.ui.ugui.TweenPosition.Begin(buttonImage.gameObject, 0.8f, new Vector3(100, 55, 0));
                tween.style = ui.ugui.UITweener.Style.PingPong;
                buttonImage.gameObject.SetActive(false);
            }
            mWorshipButtonComponent.SetClickCallback(() =>
            {
                mWorshipButtonComponent.ShowButton(false);
                if (buttonImage != null)
                {
                    buttonImage.gameObject.SetActive(false);
                }

                var data  = new C2SPlayerWorship();
                data.rank = owner.Rank;
                NetClient.GetBaseClient().SendData <C2SPlayerWorship>(NetMsg.MSG_PLAYER_WORSHIP, data);

                Actor localPlayer = Game.Instance.GetLocalPlayer();
                if (localPlayer != null)
                {
                    localPlayer.AttackCtrl.Attack(GameConstHelper.GetUint("GAME_DUNGEON_WORSHIP_SKILL_ID"));
                }
            });
            mWorshipButtonComponent.ShowButton(false);

            mTextComponent.Honor = mOwner.Honor;
            mTextComponent.Title = mOwner.Title;
        }
Example #14
0
    protected override void SetNameStyle()
    {
        UI3DText.StyleInfo styleInfo = new UI3DText.StyleInfo();
        styleInfo.Offset       = new Vector3(0, 2.8f, 0);
        styleInfo.HeadOffset   = new Vector3(0, this.Height, 0);
        styleInfo.ScreenOffset = UI3DText.NameTextScreenOffset;
        styleInfo.Scale        = Vector3.one;

        bool show_tips = false;

        styleInfo.IsShowBg  = PKModeManagerEx.Instance.IsLocalPlayerCanAttackActor(this, ref show_tips);
        styleInfo.SpritName = "Main@PKCan";
        int labelWidth = 100;//UserName.Length * 20;

        styleInfo.SpriteWidth     = labelWidth + 30;
        show_tips                 = false;
        styleInfo.IsShowBgPreHead = PKModeManagerEx.Instance.IsActorCanAttackLocalPlayer(this, ref show_tips);
        if (styleInfo.IsShowBg)
        {
            styleInfo.BgPreHeadOffset = new Vector3(styleInfo.SpriteWidth / 2 - 145, 2, 0);
        }
        else
        {
            styleInfo.BgPreHeadOffset = new Vector3(labelWidth / 2 - 110, 2, 0);
        }

        Actor local_player = Game.Instance.GetLocalPlayer();

        show_tips = false;
        styleInfo.IsEnemyRelation = !(PKModeManagerEx.Instance.IsFriendRelation(local_player, this));

        //更新归属
        xc.Machine.State       curState          = Game.GetInstance().GetFSM().GetCurState();
        CommonLuaInstanceState wildInstanceState = curState as CommonLuaInstanceState;

        if (wildInstanceState != null && wildInstanceState.DataBossBehaviour != null)
        {
            styleInfo.IsShowAffiliationPanel = wildInstanceState.DataBossBehaviour.IsAffiliation(this);
        }

        if (SceneHelp.Instance.IsInWorldBossExperienceInstance && this.IsLocalPlayer == false && this.IsPlayer() && this.IsDead())
        {
            styleInfo.LayoutIsVisiable = false;
        }
        else
        {
            styleInfo.LayoutIsVisiable = true;
        }

        // 和平模式,不显示血条,破碎死域副本内要总是显示血条
        if (PKModeManagerEx.Instance.CanShowPVPBlood(this) == false && SceneHelp.Instance.ForceShowHpBar == false)
        {
            SetShowBar(styleInfo, false);
        }
        else
        {
            SetShowBar(styleInfo, true);
        }

        TextNameBehavior nameBehavoir = GetBehavior <TextNameBehavior>();

        nameBehavoir.SetStyle(styleInfo);
    }