Ejemplo n.º 1
0
        /// <summary>
        /// 通过[职业]二分快速查表
        /// </summary>
        /// <param name="professionID">职业</param>
        /// <returns></returns>
        public static IEnumerable <SelectRoleDataBase> Query(this List <SelectRoleDataBase> sorted, uint professionID)
        {
            var key = new SelectRoleDataBase()
            {
                professionID = professionID
            };
            var comparer = new Comparer1();
            var from     = sorted.BinarySearch(key, comparer);

            if (from < 0)
            {
                yield break;
            }
            var to = from + 1;

            while (from > 0 && comparer.Compare(key, sorted[from - 1]) == 0)
            {
                from--;
            }
            while (to < sorted.Count && comparer.Compare(key, sorted[to]) == 0)
            {
                to++;
            }
            for (var i = from; i < to; i++)
            {
                yield return(sorted[i]);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 通过[职业 + 性别]二分快速查表
        /// </summary>
        /// <param name="professionID">职业</param>
        /// <param name="sexID">性别</param>
        /// <returns></returns>
        public static SelectRoleDataBase Query(this List <SelectRoleDataBase> sorted, uint professionID, uint sexID)
        {
            var key = new SelectRoleDataBase()
            {
                professionID = professionID, sexID = sexID
            };
            var comparer = new Comparer2();
            var index    = sorted.BinarySearch(key, comparer);

            return(index >= 0 ? sorted[index] : default(SelectRoleDataBase));
        }
Ejemplo n.º 3
0
    void AddSelfIcon()
    {
        if (mainPlayer == null)
        {
            return;
        }
        Transform iconTrans   = m__wordBg.transform.Find("SelfIcon");
        uint      job         = (uint)mainPlayer.GetProp((int)PlayerProp.Job);
        string    textureName = "";

        table.SelectRoleDataBase sdb = table.SelectRoleDataBase.Where((GameCmd.enumProfession)job, (GameCmd.enmCharSex) 1);
        if (sdb != null)
        {
            textureName = sdb.strprofessionIcon;
        }
        UITeammateMapInfoGrid teaminfo = null;

        if (iconTrans == null)
        {
            iconTrans = GameObject.Instantiate <Transform>(m_trans_UITeammateMapInfoGrid);
        }
        teaminfo = iconTrans.GetComponent <UITeammateMapInfoGrid>();
        if (teaminfo == null)
        {
            teaminfo = iconTrans.gameObject.AddComponent <UITeammateMapInfoGrid>();
        }
        teaminfo.SetItemInfo(textureName, mainPlayer.GetName());
        if (iconTrans != null)
        {
            iconTrans.name   = "SelfIcon";
            iconTrans.parent = m__wordBg.transform;
            if (m_dicWorldMapTrans.ContainsKey((int)m_mapid))
            {
                Transform temp = m_dicWorldMapTrans[(int)m_mapid];
                iconTrans.localPosition = temp.localPosition;
                iconTrans.gameObject.SetActive(true);
            }
            else
            {
                iconTrans.gameObject.SetActive(false);
            }
            iconTrans.localScale    = Vector3.one;
            iconTrans.localRotation = Quaternion.identity;
        }
    }
Ejemplo n.º 4
0
    void SyncTeammatePos(GameCmd.TeamPosData teamData)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es != null)
        {
            m_iconName.Remove(0, m_iconName.Length);
            m_iconName.Append(IconType.duiyouicon.ToString());
            m_iconName.Append("_");
            m_iconName.Append(teamData.uid);
            TeamMemberInfo info      = DataManager.Manager <TeamDataManager>().GetTeamMember(teamData.uid);
            string         iconName  = m_iconName.ToString();
            Transform      iconTrans = mapTex.transform.Find(iconName);

            uint   job                   = info.job;
            string textureName           = "";
            table.SelectRoleDataBase sdb = table.SelectRoleDataBase.Where((GameCmd.enumProfession)job, (GameCmd.enmCharSex) 1);
            if (sdb != null)
            {
                textureName = sdb.strprofessionIcon;
            }
            UITeammateMapInfoGrid teaminfo = null;
            if (iconTrans == null)
            {
                iconTrans = GameObject.Instantiate <Transform>(m_trans_UITeammateMapInfoGrid);

                m_duiyouList.Add(iconTrans.gameObject);
                iconTrans.name = iconName;
            }
            teaminfo = iconTrans.GetComponent <UITeammateMapInfoGrid>();
            if (teaminfo == null)
            {
                teaminfo = iconTrans.gameObject.AddComponent <UITeammateMapInfoGrid>();
            }
            if (teaminfo != null)
            {
                teaminfo.SetItemInfo(textureName, info.name);
            }

            Vector3 iconPos = GetIconPosByMapPos(new Vector3(teamData.x, 0, -teamData.y));

            AddIconToMap(iconTrans.gameObject, iconPos);
        }
    }
Ejemplo n.º 5
0
    public void SetIcon(uint job)
    {
        if (m_spIcon != null)
        {
            table.SelectRoleDataBase sdb = table.SelectRoleDataBase.Where((GameCmd.enumProfession)job, (GameCmd.enmCharSex) 1);
            if (sdb != null)
            {
                // DataManager.Manager<UIManager>().SetSpriteDynamicIcon(m_spIcon, sdb.strprofessionIcon, false);

                UIManager.GetTextureAsyn(sdb.strprofessionIcon, ref iuiIconAtlas, () =>
                {
                    if (m_spIcon != null)
                    {
                        m_spIcon.mainTexture = null;
                    }
                }, m_spIcon, false);
            }
        }
    }
Ejemplo n.º 6
0
    string GetJobName(uint job, uint sex)
    {
        string jobName = "";

        table.SelectRoleDataBase sdb = table.SelectRoleDataBase.Where((GameCmd.enumProfession)job, (GameCmd.enmCharSex)sex);

        if (sdb != null)
        {
            jobName = sdb.professionName;
        }

        //switch (job)
        //{
        //    case 1: jobName = "战士"; break;
        //    case 2: jobName = "幻师"; break;
        //    case 3: jobName = "法师"; break;
        //    case 4: jobName = "暗巫"; break;
        //}

        return(jobName);
    }
Ejemplo n.º 7
0
    void ChangeInviteState()
    {
        uint inviterID = DataManager.Manager <WelfareManager>().InviterID;
        bool isOver    = DataManager.Manager <WelfareManager>().HadBeenInvited;
        uint job       = DataManager.Manager <WelfareManager>().InviterProfession;

        m_trans_NoInviter.gameObject.SetActive(!(inviterID != 0 && isOver));
        m_trans_HasInviter.gameObject.SetActive((inviterID != 0 && isOver));
        string msg     = "";
        string jobText = "";

        table.SelectRoleDataBase data = table.SelectRoleDataBase.Where((GameCmd.enumProfession)job, (GameCmd.enmCharSex) 1);
        if (data != null)
        {
            jobText = data.professionName;
        }
        uint   lv   = DataManager.Manager <WelfareManager>().InviterLv;
        string name = DataManager.Manager <WelfareManager>().InviterName;

        msg = string.Format("{0}({1} {2})", name, lv + "级", jobText);
        m_label_InviterInfo.text = msg;
    }
Ejemplo n.º 8
0
    void OnSelChanged(enumProfession prof, enmCharSex sex, bool force = false)
    {
        if (m_curPro == prof && m_sel_sex == sex && force == false)
        {
            //没有改变
            return;
        }
        m_bLockRotate = true;
        bool havePre = m_curPro != enumProfession.Profession_None;

        GetGridByPro(prof).SetSelect(true, havePre);
        GetPropDesContent(prof).SetActive(true);
        if (havePre)
        {
            if (null != m_rightDesTA)
            {
                m_rightDesTA.ResetToBeginning();
                m_rightDesTA.Play(true);
            }
            GetGridByPro(m_curPro).SetSelect(false);
            GetPropDesContent(m_curPro).SetActive(false);
        }
        else
        {
            if (m_rightDesTA != null)
            {
                m_rightDesTA.GetComponent <UIWidget>().alpha = m_rightDesTA.to;
            }
        }
        m_prePro = m_curPro;
        m_curPro = prof;
        if (m_curPro == enumProfession.Profession_Soldier || m_curPro == enumProfession.Profession_Freeman)
        {
            sex = enmCharSex.MALE;
        }
        else
        {
            sex = enmCharSex.FEMALE;
        }
        m_sel_sex = sex;
        //for (int i = 0; i < m_lstCreateRoleBtn.Count; i++)
        //{
        //    m_lstCreateRoleBtn[i].ToggleSelectMask(m_lstCreateRoleBtn[i].m_enumProfession == m_sel_profession);
        //}

        if (m_char_obj != null)
        {
            GameObject.Destroy(m_char_obj);
        }

        //if(m_sel_sex == enmCharSex.MALE)
        //{
        //    m_sprite_male_bg.spriteName = "nan_liang";
        //    m_sprite_female_bg.spriteName = "nv_an";
        //}
        //else
        //{
        //    m_sprite_male_bg.spriteName = "nan_an";
        //    m_sprite_female_bg.spriteName = "nv_liang";
        //}


        //随机一个名字
        onClick_Random_name_Btn(null);

        //if(m_sel_sex == enmCharSex.MALE)
        //    StartCoroutine(LoadModel("ZS_Male_Show"));
        //else
        //    StartCoroutine(LoadModel("ZS_Female_Show"));

        var t = Table.Query <table.SelectRoleDataBase>();

        table.SelectRoleDataBase item = null;
        for (int i = 0; i < t.Count; i++)
        {
            if (t[i].professionID == (uint)m_curPro && t[i].Sex == m_sel_sex)
            {
                item = t[i];
                break;
            }
        }
        // var item = table.SelectRoleDataBase.Where(m_sel_profession, m_sel_sex);

        if (item == null || (item != null && string.IsNullOrEmpty(item.bodyPathRoleShowcase)))
        {
            Log.Error("角色展示模型未配置,请检查选人界面表!");
            return;
        }


        if (m_Avater != null)
        {
            RenderObjHelper.EndDissolveEffect(m_Avater.RenderObj);
        }
        if (m_Avater != null)
        {
            m_Avater.Destroy();
            m_Avater = null;
        }

        if (m_model_node == null)
        {
            Engine.Utility.Log.Error("m_model_node 为 null !!!");
            return;
        }

        m_model_node.transform.DestroyChildren();
        rotateY = m_model_node.localRotation.y;

        //var table_data = GameTableManager.Instance.GetTableItem<table.SuitDataBase>((uint)item.createRoleResID);


        //创建角色,模型自带武器
        var ritem = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>((uint)item.createRoleResID);

        if (ritem == null)
        {
            Engine.Utility.Log.Error("ritem 为 null !!!");
            return;
        }

        Client.AvatarUtil.CreateAvater(ref m_Avater, ritem.strPath, m_model_node, m_model_node.gameObject.layer, OnCreateAvater, (int)prof);

        Engine.IRenderSystem renderSys = Engine.RareEngine.Instance().GetRenderSystem();
        if (renderSys == null)
        {
            return;
        }

        for (int i = m_CurShowEffect.Count - 1; i >= 0; i--)
        {
            Engine.IEffect effect = m_CurShowEffect[i];
            renderSys.RemoveEffect(effect);
        }
        m_CurShowEffect.Clear();
    }
Ejemplo n.º 9
0
    void ShowRoleTexture(bool bPlayer, table.NpcDataBase npcDb = null)
    {
        if (m_RTObj != null)
        {
            m_RTObj.Release();
        }
        if (bPlayer)
        {
            m_RTObj = DataManager.Manager <RenderTextureManager>().CreateRenderTextureObj(MainPlayerHelper.GetMainPlayer(), 700);
        }
        else if (npcDb != null)
        {
            m_RTObj = DataManager.Manager <RenderTextureManager>().CreateRenderTextureObj((int)npcDb.dwViewModelSet, 700);
        }
        if (m_RTObj == null)
        {
            return;
        }
        if (bPlayer)
        {
            Client.IPlayer player = MainPlayerHelper.GetMainPlayer();
            if (player == null)
            {
                return;
            }
            uint job = (uint)player.GetProp((int)Client.PlayerProp.Job);
            int  sex = (int)player.GetProp((int)Client.PlayerProp.Sex);
            table.SelectRoleDataBase roleSelectData = GameTableManager.Instance.GetTableItem <table.SelectRoleDataBase>(job, sex);
            float offsety  = 1.5f;
            float distance = 1.7f;
            float rotateX  = 0f;
            if (roleSelectData != null)
            {
                offsety  = roleSelectData.offsetY * 0.01f;
                distance = roleSelectData.distance * 0.01f;
                rotateX  = roleSelectData.diaRotateX * 0.01f;
            }

            m_RTObj.SetCamera(new Vector3(0f, offsety, 0), new Vector3(rotateX, 0, 0), distance);
            //m_RTObj.SetCamera(new Vector3(0f, offsety, 0), Vector3.zero, distance);
        }
        else
        {
            float offsety  = 1.0f;
            float distance = 1.7f;
            float rotateX  = 0f;
            if (npcDb != null)
            {
                offsety  = npcDb.diaOffsetY * 0.01f;
                distance = npcDb.diaDistance * 0.01f;
                rotateX  = npcDb.diaRotateX * 0.01f;
            }

            m_RTObj.SetCamera(new Vector3(0f, offsety, 0), new Vector3(rotateX, 0, 0), distance);
            //m_RTObj.SetCamera(new Vector3(0f, offsety, 0), Vector3.zero, distance);
        }
        rotateY = 170f;
        //设置人物旋转
        m_RTObj.SetModelRotateY(rotateY);
        m_RTObj.PlayModelAni(Client.EntityAction.Stand);

        //人物
        if (m__NpcTexture != null)
        {
            m__NpcTexture.mainTexture = m_RTObj.GetTexture();
            //m__NpcTexture.MakePixelPerfect();
        }
    }
Ejemplo n.º 10
0
    /// <summary>
    /// 武斗场主界面
    /// </summary>
    void UpdateArenaMain()
    {
        if (challengIntervalCoroutine != null)
        {
            StopCoroutine(challengIntervalCoroutine);
        }

        AManager.ChallengeTarget = null;//清除挑战对手

        //前三名  top3
        //UpdateTopThree();

        //挑战的3个对手
        //UpdateRivalThree();



        //排行
        m_label_MyRanking.text = AManager.Rank.ToString();

        IPlayer player = Client.ClientGlobal.Instance().MainPlayer;

        if (player != null)
        {
            //icon
            int profession = player.GetProp((int)PlayerProp.Job);
            table.SelectRoleDataBase sdb = table.SelectRoleDataBase.Where((GameCmd.enumProfession)profession, (GameCmd.enmCharSex) 1);
            if (sdb != null)
            {
                UIManager.GetTextureAsyn(sdb.strprofessionIcon, ref iuiIconAtlas,
                                         () =>
                {
                    if (m__MainPlayerIcon != null)
                    {
                        m__MainPlayerIcon.mainTexture = null;
                    }
                },
                                         m__MainPlayerIcon, false);
            }

            //name
            m_label_MainPlayerName.text = player.GetName();

            //level
            m_label_MainPlayerLevel.text = player.GetProp((int)CreatureProp.Level).ToString();

            //战斗力
            m_label_MyFighting.text = player.GetProp((int)FightCreatureProp.Power).ToString();
        }

        //刷新挑战次数
        ChallengeTimesUpdate();

        //刷新CD
        CDUpdate();

        m_trans_gridContent.localPosition = new Vector3(0, m_trans_gridContent.localPosition.y, m_trans_gridContent.localPosition.z);
        m_btn_leftArrow.gameObject.SetActive(true);
        m_btn_rightArrow.gameObject.SetActive(false);

        //UICenterOnChild centerOnChild = m_grid_grid.GetComponent<UICenterOnChild>();
        //if (centerOnChild == null)
        //{
        //    centerOnChild = m_grid_grid.gameObject.AddComponent<UICenterOnChild>();
        //}
        //centerOnChild.onCenter = OnCenterOnChildCallback; //控制左右箭头
    }
Ejemplo n.º 11
0
    /// <summary>
    /// 右边自己的UI
    /// </summary>
    /// <param name="text"></param>
    private void SetChatMsgUI_Right(ChatInfo text)
    {
        Vector3 origin = m_trans_redPacket.localPosition;

        m_trans_redPacket.localPosition = new Vector3(187, origin.y, 0);
        if (m_headIcon != null)
        {
            //m_headIcon.ChangeSprite(text.job);
            //m_headIcon.MakePixelPerfect();
            m_headIcon.transform.localPosition = new Vector3(m_panelWidth * 0.5f - BorderX - m_headIcon.width, 0, 0);

            table.SelectRoleDataBase sdb = table.SelectRoleDataBase.Where((GameCmd.enumProfession)text.job, (GameCmd.enmCharSex) 1);
            if (sdb != null)
            {
                UIManager.GetTextureAsyn(sdb.strprofessionIcon, ref iuiIcon, () => { if (m_headIcon != null)
                                                                                     {
                                                                                         m_headIcon.mainTexture = null;
                                                                                     }
                                         }, m_headIcon, false);
            }
        }
        if (m_spriteNameBg != null)
        {
            m_spriteNameBg.enabled = false;
        }
        m_lableChannel.text = "";
        m_lableName.text    = "";
        UISprite sp = m_bgSprite as UISprite;

        sp.spriteName    = "biankuang_duihuayou";
        m_bgSprite.width = GetMaxWidth() - 10;//右边小箭头


        if (!string.IsNullOrEmpty(text.voiceFileid))
        {
            m_goVoiceTip.gameObject.SetActive(false);
            //m_spriteVoiceBg.transform.localPosition = new UnityEngine.Vector3(85, -57, 0);
            m_goVoice.SetActive(true);
            m_labelVoice.text = string.Format("{0}'", text.voiceLegth.ToString());
            m_normalRichTextContext.offset = new Vector2(15f, 0);
            //没有执行AddNewLine()先指定m_layout
            m_normalRichTextContext.m_layout = new Vector2(15f, -60f);
        }
        else
        {
            m_goVoice.gameObject.SetActive(false);
            m_normalRichTextContext.offset = new Vector2(15f, 0);
            //没有执行AddNewLine()先指定m_layout
            m_normalRichTextContext.m_layout = new Vector2(15f, -10f);
        }

        m_normalRichTextContext.AddXml(text.Content);

        m_bgSprite.height = Mathf.CeilToInt(-m_normalRichTextContext.m_layout.y) + 10;

        if (m_normalRichTextContext.overline)
        {
            m_bgSprite.width = GetMaxWidth();
        }
        else
        {
            m_bgSprite.width = Mathf.CeilToInt(m_normalRichTextContext.m_layout.x) + 25;
        }


        if (!string.IsNullOrEmpty(text.voiceFileid))
        {
            if (m_bgSprite.width < VOICEBGWIDTH)
            {
                m_bgSprite.width = VOICEBGWIDTH;
            }
            float posx = m_headIcon.transform.localPosition.x - BorderX - m_bgSprite.width;
            m_bgSprite.transform.localPosition = new Vector3(posx, -m_headIcon.height * 0.5f, 0);
            posx = m_headIcon.transform.localPosition.x - m_spriteVoiceBg.width * 0.5f - 40;
            m_goVoice.transform.localPosition    = new UnityEngine.Vector3(posx, -m_headIcon.height * 0.5f - 28, 0);
            m_goVoice.transform.localRotation    = Quaternion.Euler(new Vector3(0, 180, 0));
            m_labelVoice.transform.localRotation = Quaternion.Euler(new Vector3(0, 180, 0));
            m_labelVoice.transform.localPosition = new UnityEngine.Vector3(-m_labelVoice.transform.localPosition.x, 0, 0);
        }
        else
        {
            float posx = m_headIcon.transform.localPosition.x - BorderX - m_bgSprite.width;
            m_bgSprite.transform.localPosition = new Vector3(posx, -m_headIcon.height * 0.5f, 0);
        }


        bound = NGUIMath.CalculateRelativeWidgetBounds(transform, false);
    }
Ejemplo n.º 12
0
    private void SetChatMsgUI_Left(ChatInfo text)
    {
        Vector3 origin = m_trans_redPacket.localPosition;

        m_trans_redPacket.localPosition = new Vector3(146, origin.y, 0);
        if (m_headIcon != null)
        {
            if (text.Channel == GameCmd.CHATTYPE.CHAT_GM)
            {
                UIManager.GetTextureAsyn("n031", ref iuiIconAtlas, () =>
                {
                    if (null != m_headIcon)
                    {
                        m_headIcon.mainTexture = null;
                    }
                }, m_headIcon);
            }
            else
            {
                table.SelectRoleDataBase sdb = table.SelectRoleDataBase.Where((GameCmd.enumProfession)text.job, (GameCmd.enmCharSex) 1);
                if (sdb != null)
                {
                    UIManager.GetTextureAsyn(sdb.strprofessionIcon, ref iuiIcon,
                                             () => { if (m_headIcon != null)
                                                     {
                                                         m_headIcon.mainTexture = null;
                                                     }
                                             },
                                             m_headIcon, false);
                }
            }
            m_headIcon.transform.localPosition = new Vector3(-m_panelWidth * 0.5f + BorderX, 0, 0);
        }
        if (GameCmd.CHATTYPE.CHAT_GMTOOL == text.Channel)
        {
            text.Channel = GameCmd.CHATTYPE.CHAT_GMTOOL;
        }

        if (text.Channel == GameCmd.CHATTYPE.CHAT_SILENT)
        {
            if (DataManager.Manager <RelationManager>().IsMyFriend(text.Id))
            {
                m_lableChannel.text = "好友";
            }
            else
            {
                m_lableChannel.text = "陌生人";
            }
        }
        else
        {
            m_lableChannel.text = DataManager.Manager <ChatDataManager>().GetChannelStr(text.Channel);
        }

        m_lableChannel.transform.localPosition = m_headIcon.transform.localPosition + new Vector3(m_headIcon.width + 25, 0, 0);


        m_lableName.text = text.Name;
        m_lableName.transform.localPosition = m_lableChannel.transform.localPosition + new Vector3(m_lableChannel.width + 5, 0, 0);

        if (m_spriteNameBg != null)
        {
            m_spriteNameBg.transform.localPosition = m_lableChannel.transform.localPosition + new Vector3(-5, 5, 0);
            m_spriteNameBg.width   = m_lableChannel.width + 10;
            m_spriteNameBg.height  = m_lableChannel.fontSize + 10;
            m_spriteNameBg.enabled = true;
            m_spriteNameBg.ChangeSprite(GetChannelIndex(text.Channel));
        }

        UISprite sp = m_bgSprite as UISprite;

        sp.spriteName = "biankuang_duihuazuo";

        m_bgSprite.width = GetMaxWidth() - 10;//左边小箭头

        if (!string.IsNullOrEmpty(text.voiceFileid))
        {
            m_goVoice.gameObject.SetActive(true);
            m_goVoiceTip.SetActive(!m_chatdata.played);

            m_labelVoice.text = string.Format("{0}'", text.voiceLegth.ToString());

            //从左边25开始
            m_normalRichTextContext.offset = new Vector2(25, 0);
            //没有执行AddNewLine()先指定m_layout
            m_normalRichTextContext.m_layout = new Vector2(25, -60f);
        }
        else
        {
            m_goVoice.gameObject.SetActive(false);

            //从左边25开始
            m_normalRichTextContext.offset = new Vector2(25, 0);
            //没有执行AddNewLine()先指定m_layout
            m_normalRichTextContext.m_layout = new Vector2(25, -10f);
        }
        m_normalRichTextContext.AddXml(text.Content);

        m_bgSprite.height = Mathf.CeilToInt(-m_normalRichTextContext.m_layout.y) + 10;

        if (m_normalRichTextContext.overline)
        {
            m_bgSprite.width = GetMaxWidth();
        }
        else
        {
            m_bgSprite.width = Mathf.CeilToInt(m_normalRichTextContext.m_layout.x) + 15;//多添加15
        }

        if (!string.IsNullOrEmpty(text.voiceFileid))
        {
            if (m_bgSprite.width < VOICEBGWIDTH)
            {
                m_bgSprite.width = VOICEBGWIDTH;
            }
            m_bgSprite.transform.localPosition = new Vector3(m_headIcon.transform.localPosition.x + m_headIcon.width + BorderX + headRightOffset, m_bgSprite.transform.localPosition.y, 0);

            float posx = m_bgSprite.transform.localPosition.x + m_spriteVoiceBg.width * 0.5f + 40;
            m_goVoice.transform.localPosition    = new UnityEngine.Vector3(posx, -m_headIcon.height * 0.5f - 28, 0);
            m_goVoice.transform.localRotation    = Quaternion.Euler(Vector3.zero);
            m_labelVoice.transform.localRotation = Quaternion.Euler(Vector3.zero);
            m_labelVoice.transform.localPosition = new UnityEngine.Vector3(-m_labelVoice.transform.localPosition.x, 0, 0);
        }
        else
        {
            m_bgSprite.transform.localPosition = new Vector3(m_headIcon.transform.localPosition.x + m_headIcon.width + BorderX + headRightOffset, m_bgSprite.transform.localPosition.y, 0);
        }
        bound = NGUIMath.CalculateRelativeWidgetBounds(transform, false);
    }
Ejemplo n.º 13
0
    protected override void OnShow(object data)
    {
        base.OnShow(data);
        m_datainfo = null;
        if (data is PlayerViewInfo)
        {
            PlayerViewInfo info = (PlayerViewInfo)data;
            m_datainfo = info;
            m_label_playerLevel.text = "等级:" + info.level.ToString();
            //m_label_playerId.text = "ID: " + info.uid.ToString();
            m_label_playername.text = info.name;
            uint clanId = info.clanid;
            if (clanId != 0)
            {
                DataManager.Manager <ClanManger>().GetClanName(clanId, (namedata) =>
                {
                    string winerCityName = string.Empty;
                    string name          = string.Empty;
                    if (DataManager.Manager <CityWarManager>().GetWinerOfCityWarCityName((uint)clanId, out winerCityName))
                    {
                        //name = winerCityName + namedata.ClanName;
                        name = string.Format("{0}【{1}】", winerCityName, namedata.ClanName);
                    }
                    else
                    {
                        //name = namedata.ClanName;
                        name = string.Format("【{0}】", namedata.ClanName);
                    }
                    m_label_playerClan.text = "氏族:" + name;
                });
            }
            else
            {
                m_label_playerClan.text = "氏族:无";
            }
            //m_spriteEx_icon_head.ChangeSprite(info.job);

            //icon
            table.SelectRoleDataBase sdb = table.SelectRoleDataBase.Where((GameCmd.enumProfession)info.job, (GameCmd.enmCharSex) 1);
            if (sdb != null)
            {
                UIManager.GetTextureAsyn(sdb.strprofessionIcon, ref m_playerAvataCASD, () =>
                {
                    if (null != m__icon_head)
                    {
                        m__icon_head.mainTexture = null;
                    }
                }, m__icon_head);
            }

            //             if (info.teamNum <= 0)
            //          {
            //                 m_label_playerTeam.text = "无队伍";
            //             }
            //             else
            //             {
            //                 m_label_playerTeam.text = string.Format("队伍:{0}/{1}", info.teamNum, info.teamMaxNum);
            //             }

            UpdatePlayerViewBtnsStatus();
            bool isFriend = DataManager.Manager <RelationManager>().IsMyFriend(info.uid);
            m_btn_btn_addfriend.GetComponentInChildren <UILabel>().text = isFriend ? "删除好友" : "添加好友";
        }
        else
        {
            Engine.Utility.Log.Error("PlayerOpreatePanel 传入数据类型不对");
        }
    }