Example #1
0
    public static void AddNotifyData(string data, bool IsFilterRepeat = false)
    {
        string str = "";

        if (!string.IsNullOrEmpty(data))
        {
            char firstChar = data[0];
            if (firstChar != '#')
            {
                str = data;
            }
            else
            {
                str = StrDictionary.GetServerDictionaryFormatString(data);
            }
        }
        if (NotifyDataList.Count > 0 && IsFilterRepeat)
        {
            if (NotifyDataList[NotifyDataList.Count - 1] != str)
            {
                NotifyDataList.Add(str);
            }
        }
        else
        {
            NotifyDataList.Add(str);
        }

        UIManager.ShowUI(UIInfo.CentreNotice);
        //NotifyDataQueue.Enqueue(str);
    }
Example #2
0
    public void ShowRollNotice()
    {
        if (bPlayRollFlag)
        {
            return;
        }
        List <string> NoticeList = GameManager.gameManager.PlayerDataPool.RollNoticeList;

        if (NoticeList.Count <= 0)
        {
            return;
        }
        string StrDic = NoticeList[0];

        if (objNoticeLables)
        {
            if (!string.IsNullOrEmpty(StrDic))
            {
                Init();
                string str       = "";
                char   firstChar = StrDic[0];
                if (firstChar != '#')
                {
                    str = StrDic;
                }
                else
                {
                    str = StrDictionary.GetServerDictionaryFormatString(StrDic);
                }
                objNoticeLables.text = str;
            }
        }

        bPlayRollFlag = true;
        NoticeList.RemoveAt(0);
    }
        public uint Execute(PacketDistributed ipacket)
        {
            GC_CREATE_ZOMBIEUSER packet = (GC_CREATE_ZOMBIEUSER)ipacket;

            if (null == packet)
            {
                return((uint)PACKET_EXE.PACKET_EXE_ERROR);
            }
            //安全措施,如果发现ServerID已经存在,则先移除掉
            if (Singleton <ObjManager> .GetInstance().IsObjExist(packet.ServerId))
            {
                Singleton <ObjManager> .GetInstance().RemoveObj(packet.ServerId);
            }

            Obj_Init_Data initData = new Obj_Init_Data();

            //  initData.CleanUp();
            initData.m_ServerID   = packet.ServerId;
            initData.m_fX         = ((float)packet.PosX) / 100;
            initData.m_fZ         = ((float)packet.PosZ) / 100;
            initData.m_RoleBaseID = packet.DataId;
            initData.m_Force      = packet.Curforce;
            if (!string.IsNullOrEmpty(packet.Name))
            {
                char   firstChar    = packet.Name[0];
                string szNameResult = "";
                if (firstChar == '#' && 0 == StrDictionary.GetServerDictionaryFormatString(packet.Name, ref szNameResult))
                {
                    initData.m_StrName = szNameResult;
                }
                else
                {
                    initData.m_StrName = packet.Name;
                }
            }

            initData.m_IsDie           = packet.IsDie == 1 ? true : false;
            initData.m_MoveSpeed       = ((float)packet.Movespeed) / 100;
            initData.m_fDir            = (float)packet.Facedir / 100;
            initData.m_ModelVisualID   = packet.ModelVisualID;
            initData.m_WeaponDataID    = packet.Weaponid;
            initData.m_WeaponEffectGem = packet.WeaponEffectGem;
            initData.m_StealthLev      = packet.StealthLev;
            initData.m_nProfession     = packet.Profession;
            if (packet.HasBindparent)
            {
                initData.m_BindParent = packet.Bindparent;
            }
            initData.m_BindChildren.Clear();
            for (int nindex = 0; nindex < GlobeVar.BIND_CHILDREN_MAX; ++nindex)
            {
                if (nindex < packet.bindchildrenCount)
                {
                    initData.m_BindChildren.Add(packet.GetBindchildren(nindex));
                }
                else
                {
                    initData.m_BindChildren.Add(-1);
                }
            }
            Singleton <ObjManager> .GetInstance().NewCharacterObj(Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_ZOMBIE_PLAYER, initData);

            return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
        }
Example #4
0
    /// <summary>
    /// 切换目标
    /// </summary>
    /// <param name="targetObj">目标obj</param>
    public void ChangeTarget(Obj_Character targetObj)
    {
        if (!m_bFold)
        {
            ShowTargetFrame();
        }
        if (targetObj == null || targetObj.BaseAttr == null)
        {
            LogModule.ErrorLog("ChangeTarget called but targetObj targetObj == null || targetObj.BaseAttr == null");
            return;
        }

        SwitchHpInfo(targetObj);

        m_hasTarget = true;
        bool isSameTarget = false;

        if (null == targetObj)
        {
            return;
        }

        if (m_TargetServerID == targetObj.ServerID)
        {
            isSameTarget = true;
        }
        else
        {
            m_TargetLevelText.text = "Lv 0";
            ClearHpShow();
            m_TargetMPSprite.fillAmount    = 0;
            m_TargetMPBakSprite.fillAmount = 0;
            m_nLastMp = 0;
        }
        m_TargetServerID = targetObj.ServerID;
        if (targetObj.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER ||
            targetObj.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER ||
            targetObj.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_ZOMBIE_PLAYER)
        {
            Obj_OtherPlayer otherPlayer = targetObj as Obj_OtherPlayer;
            if (null != otherPlayer)
            {
                m_TargetGuid = otherPlayer.GUID;
                if (!string.IsNullOrEmpty(otherPlayer.BaseAttr.RoleName))
                {
                    char   firstChar    = otherPlayer.BaseAttr.RoleName[0];
                    string szNameResult = "";
                    if (firstChar == '#' && 0 == StrDictionary.GetServerDictionaryFormatString(otherPlayer.BaseAttr.RoleName, ref szNameResult))
                    {
                        otherPlayer.BaseAttr.RoleName = szNameResult;
                    }
                }
                m_strTargetName = otherPlayer.BaseAttr.RoleName;
            }
        }
        else
        {
            m_TargetGuid    = GlobeVar.INVALID_GUID;
            m_strTargetName = "";
        }
        if (GameManager.gameManager.RunningScene == (int)Games.GlobeDefine.GameDefine_Globe.SCENE_DEFINE.SCENE_FB_CABALINTRO)
        {
            if (targetObj.BaseAttr.RoleBaseID == 1080)
            {
                m_TargetLevelText.text = string.Format("Lv {0}", 100);
            }
            else if (targetObj.BaseAttr.RoleBaseID == 1079)
            {
                m_TargetLevelText.text = string.Format("Lv {0}", 90);
            }
            else
            {
                // 玩家
                m_TargetLevelText.text = string.Format("Lv {0}", 100);
            }
        }
        else
        {
            m_TargetLevelText.text = string.Format("Lv {0}", targetObj.BaseAttr.Level);
        }

        SetTargetName(targetObj);

        bool isWorldBoss = (targetObj.BaseAttr.RoleBaseID == 847);

        if (isWorldBoss == true || IsGuildBossNpc(targetObj) == true)
        {
            //m_TargetHPText.text = "???" + "/" + "???";
            float perCent = (float)targetObj.BaseAttr.HP / (float)targetObj.BaseAttr.MaxHP * 100;
            if (m_HpInfo.m_TargetHPText != null)
            {
                m_HpInfo.m_TargetHPText.text = perCent.ToString("0.000") + "%";
            }
        }
        else
        {
            if (m_HpInfo.m_TargetHPText != null)
            {
                m_HpInfo.m_TargetHPText.text = Utils.ConvertLargeNumToString(targetObj.BaseAttr.HP) + "/" + Utils.ConvertLargeNumToString(targetObj.BaseAttr.MaxHP);
            }
        }
        int hpCount = 1;

        if (targetObj.BaseAttr.CachedRoleBase != null)
        {
            hpCount = targetObj.BaseAttr.CachedRoleBase.HpCount;
        }

        Obj_NPC npcObj = targetObj as Obj_NPC;

        m_isNpc = false;
        if (null != npcObj)
        {
            if (npcObj.NpcType == GameDefine_Globe.NPC_TYPE.BOSS)
            {
                m_isNpc = true;
                UpdateBossHpShow(targetObj.BaseAttr.HP, targetObj.BaseAttr.MaxHP, hpCount);
            }
        }

        UpdateHpShow(targetObj.BaseAttr.HP, targetObj.BaseAttr.MaxHP, hpCount);

        // 蓝条范围 0.345~1
        //玩家才显示蓝条
        if (targetObj.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER ||
            targetObj.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER ||
            targetObj.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_ZOMBIE_PLAYER)
        {
            Obj_OtherPlayer _Player = targetObj as Obj_OtherPlayer;
            if (_Player)
            {
                m_isNeedShowMp = true;
                m_TargetMPSprite.gameObject.SetActive(true);
                m_TargetMPText.gameObject.SetActive(true);


//                 m_TargetMPSprite.spriteName = "MagicBar";
//                 m_TargetMPSprite.MakePixelPerfect();
//                 m_TargetMPBakSprite.spriteName = "MagicBar1";
//                 m_TargetMPBakSprite.MakePixelPerfect();

                if (targetObj.BaseAttr.MaxMP > 0)
                {
                    m_TargetMPSprite.fillAmount = (float)targetObj.BaseAttr.MP / (float)targetObj.BaseAttr.MaxMP;
                }
                else
                {
                    m_TargetMPSprite.fillAmount = 0;
                }
                m_TargetMPText.text = Utils.ConvertLargeNumToString(targetObj.BaseAttr.MP) + "/" + Utils.ConvertLargeNumToString(targetObj.BaseAttr.MaxMP);
                if (m_TargetMPSprite.fillAmount <= 0)
                {
                    m_TargetMPSprite.fillAmount    = 0;
                    m_TargetMPBakSprite.fillAmount = 0;
                    m_fMPBakSpeed = 0.003f;
                }
                else if (m_TargetMPBakSprite.fillAmount - m_TargetMPSprite.fillAmount > 0)
                {
                    m_fMPBakSpeed = (m_TargetMPBakSprite.fillAmount - m_TargetMPSprite.fillAmount) * Time.deltaTime;
                }
                else if (m_TargetMPBakSprite.fillAmount - m_TargetMPSprite.fillAmount < 0)
                {
                    m_TargetMPBakSprite.fillAmount = m_TargetMPSprite.fillAmount;
                }
                if (isSameTarget && m_nLastMp <= targetObj.BaseAttr.MP)
                {
                    m_TargetMPBakSprite.fillAmount = m_TargetMPSprite.fillAmount;
                }
            }
        }
        else
        {
            m_isNeedShowMp = false;
            m_TargetMPSprite.gameObject.SetActive(false);
            m_TargetMPText.gameObject.SetActive(false);
            m_TargetMPBakSprite.gameObject.SetActive(false);
        }
        //if (m_TargetHeadSprite != null)
        //{
        //    m_TargetHeadSprite.spriteName = targetObj.BaseAttr.HeadPic;
        //    m_TargetHeadSprite.MakePixelPerfect();
        //}
        //else
        //{
        //LogModule.WarningLog("TargetFrameRoot prefab m_TargetHeadSprite is null");
        //}
        m_nLastMp = targetObj.BaseAttr.MP;

        //if (targetObj.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_NPC)
        //{
        //    Obj_NPC targetNPC = targetObj as Obj_NPC;
        //    if (null == targetNPC)
        //    {
        //        return;
        //    }
        //    if (targetNPC.BelongObjID != GlobeVar.INVALID_ID && targetNPC.BelongTeamID == GlobeVar.INVALID_ID)
        //    {
        //        if (Singleton<ObjManager>.Instance.MainPlayer != null &&
        //            Singleton<ObjManager>.Instance.MainPlayer.ServerID == targetNPC.BelongObjID)
        //        {
        //            m_BelongSprite.SetActive(true);
        //        }
        //        else
        //        {
        //            m_BelongSprite.SetActive(false);
        //        }
        //    }
        //    else if (targetNPC.BelongObjID == GlobeVar.INVALID_ID && targetNPC.BelongTeamID != GlobeVar.INVALID_ID)
        //    {
        //        if (GameManager.gameManager.PlayerDataPool.TeamInfo.TeamID == targetNPC.BelongTeamID)
        //        {
        //            m_BelongSprite.SetActive(true);
        //        }
        //        else
        //        {
        //            m_BelongSprite.SetActive(false);
        //        }
        //    }
        //}
    }
Example #5
0
        public virtual void UpdateAttrBroadcastPackt(GC_BROADCAST_ATTR packet)
        {
            //bind parent
            if (packet.HasBindparent)
            {
                BindParent = packet.Bindparent;
            }
            //bind children
            // 没数据 也别更新啦
            if (packet.bindchildrenCount > 0)
            {
                List <int> newlist = new List <int>(packet.bindchildrenList);
                UpdateBindChildren(newlist);
            }
            if (packet.HasName)
            {
                if (!string.IsNullOrEmpty(packet.Name))
                {
                    char   firstChar    = packet.Name[0];
                    string szNameResult = "";
                    if (firstChar == '#' && 0 == StrDictionary.GetServerDictionaryFormatString(packet.Name, ref szNameResult))
                    {
                        BaseAttr.RoleName = szNameResult;
                    }
                    else
                    {
                        BaseAttr.RoleName = packet.Name;
                    }
                }
                OptNameChange();
            }
            if (packet.HasCurForce)
            {
                BaseAttr.Force = packet.CurForce;
                OptForceChange();
            }
            if (packet.HasVipCost)
            {
                if (ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
                {
                    Obj_MainPlayer mainPlayer = this as Obj_MainPlayer;
                    if (mainPlayer != null)
                    {
                        mainPlayer.VipCost = packet.VipCost;
                        //更新自动挂机
                        if (mainPlayer.BaseAttr.Level >= GlobeVar.MAX_AUTOEQUIT_LIVE && VipData.GetVipLv() >= GlobeVar.USE_AUTOFIGHT_VIPLEVEL)
                        {
                            //vip2的时候选择自动强化
                            mainPlayer.UpdateSelectEquip();
                        }
                    }
                }
                if (ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER)
                {
                    Obj_OtherPlayer otherPlayer = this as Obj_OtherPlayer;
                    if (otherPlayer != null)
                    {
                        otherPlayer.VipCost = packet.VipCost;
                    }
                }
            }
            if (packet.HasCombatValue)
            {
                if (ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
                {
                    Obj_MainPlayer mainPlayer = this as Obj_MainPlayer;
                    if (mainPlayer != null)
                    {
                        mainPlayer.OtherCombatValue = packet.CombatValue;
                        mainPlayer.UpdateCombatValue();
                    }
                }
                if (ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER)
                {
                    Obj_OtherPlayer otherPlayer = this as Obj_OtherPlayer;
                    if (otherPlayer != null)
                    {
                        otherPlayer.OtherCombatValue = packet.CombatValue;
                        otherPlayer.UpdateCombatValue();
                    }
                }
            }

            if (packet.HasMoveSpeed)
            {
                BaseAttr.MoveSpeed = packet.MoveSpeed / 100.0f;
                if (NavAgent != null)
                {
                    NavAgent.speed = BaseAttr.MoveSpeed;
                }

                //主角的伙伴需要特殊处理
                if (ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_FELLOW)
                {
                    Obj_Fellow fellowObj = this as Obj_Fellow;
                    if (null != fellowObj && fellowObj.IsOwnedByMainPlayer())
                    {
                        fellowObj.SetMoveSpeedAsMainPlayer();
                    }
                }
                //主角速度变化把自己伙伴的速度也改变
                if (ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
                {
                    Obj_MainPlayer mainPlayer = this as Obj_MainPlayer;
                    if (mainPlayer != null)
                    {
                        Obj_Fellow fellowObj = mainPlayer.GetCurFellow();
                        if (fellowObj != null)
                        {
                            fellowObj.SetMoveSpeedAsMainPlayer();
                        }
                    }
                }
            }
            if (packet.HasBDie)
            {
                bool bDie = packet.BDie == 1;
                if (bDie == true)
                {
                    OnDie();
                }
            }
            if (packet.HasStealthLev)
            {
                StealthLev = packet.StealthLev;
                OptStealthLevChange();
            }
        }
    //初始化聊天title和内容
    public void MakeTitleEnable(string fulltext, ChatHistoryItem history)
    {
        if (string.IsNullOrEmpty(history.ChatInfo))
        {
            return;
        }
        string strChannelName = "";

//         if (history.EChannel != GC_CHAT.CHATTYPE.CHAT_TYPE_PROVINCE)
//         {
        strChannelName = Utils.GetChannelName((int)history.EChannel);
        //    }
//         else
//         {
//             strChannelName = Utils.GetProvinceName(history.ProvinceID);
//             strChannelName = StrDictionary.GetClientDictionaryString("#{5680}", strChannelName);
//         }
        string strSenderName = "";
        string strChatInfo   = history.ChatInfo;

        if (history.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_TELL || history.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_FRIEND ||
            history.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_SYSTEM || history.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_GUILD)
        {
            // 系统频道可能无发送人
            if (history.SenderGuid != GlobeVar.INVALID_GUID && history.SenderName != "")
            {
                //strSenderName = StrDictionary.GetClientDictionaryString("#{5548}", history.SenderName);//{0}
                strSenderName = history.SenderName;//{0}
            }

            if (strChatInfo.Length > 0 && strChatInfo[0] == '#')
            {
                strChatInfo = StrDictionary.GetServerDictionaryFormatString(strChatInfo);
            }

            if (history.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_SYSTEM)
            {
                strSenderName = StrDictionary.GetClientDictionaryString("#{4336}");
            }
        }
        else if (history.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_LOUDSPEAKER)
        {
            //strSenderName = StrDictionary.GetClientDictionaryString("#{5548}", history.SenderName);//{0}:
            strSenderName = history.SenderName;
            if (strChatInfo.Length > 0 && strChatInfo[0] == '#')
            {
                strChatInfo = StrDictionary.GetServerDictionaryFormatString(strChatInfo);
            }
        }
        else
        {
            if (history.ELinkType.Count > 0 && history.GetLinkIntDataCountByIndex(0) == (int)GC_CHAT.LINKTYPE.LINK_TYPE_GUILDCRUITE)
            {
                strSenderName = "[" + StrDictionary.GetClientDictionaryString("#{3108}", "") + "]:";//招募
            }
            else
            {
                //strSenderName = StrDictionary.GetClientDictionaryString("#{5548}", history.SenderName);//{0}
                strSenderName = history.SenderName;
            }
        }
        string strChatTitle    = strChannelName + strSenderName;//频道+名字
        string strChannelColor = Utils.GetChannelColor(history);

        strChatTitle = strChannelColor + strChatTitle;
        strChatTitle = ShowVIPIcon(strChatTitle, history);
        string strChatDetail = null;

        if (history.SenderGuid != GlobeVar.INVALID_GUID && history.SenderName != "")
        {
            strChatDetail   = strChatInfo;
            strChannelColor = "[FFFFFF]";
        }
        else
        {
            if (history.EChannel != GC_CHAT.CHATTYPE.CHAT_TYPE_SYSTEM)
            {
                strChatDetail   = strChatTitle + strChatInfo;
                strChatTitle    = null;
                strChannelColor = Utils.GetChannelColor(history);
            }
            else // 系统消息特殊处理,有其他需要也在这里进行处理
            {
                strChatDetail   = strChatInfo;
                strChannelColor = Utils.GetChannelColor(history);
            }
        }
        m_Space_Width = m_Font.CalculatePrintedSize("  ", true, UIFont.SymbolStyle.Uncolored).x;

        SelectTextNumber();
        // 显示聊天信息
        if (history.ELinkType.Count > 0)
        {
            strChatDetail = MakeLinkEnabled(strChatDetail, history);
        }
        strChatDetail = MakeEmotionEnabled(strChatDetail, history);
        strChatDetail = ShowPlayVoiceBtn(strChatDetail, history);

        strChatDetail = strChannelColor + strChatDetail;
        StringBuilder bd = new StringBuilder(512);

        if (history.SenderGuid == Singleton <ObjManager> .GetInstance().MainPlayer.GUID)
        {
            SPACE_WIDTH = (int)m_Font.CalculatePrintedSize(" ", true, UIFont.SymbolStyle.Uncolored).x;
            Vector2 space = m_Font.CalculatePrintedSize(strChatDetail, true, UIFont.SymbolStyle.Uncolored);
            //如果没有换行 前面塞点空格,把文字往右边推下 (什么玩意破代码,写的都什么啊。。。。。rubbish)
            if (!strChatDetail.Contains(Environment.NewLine))
            {
                if (space.x < m_ChatInfoItemWidth && SPACE_WIDTH != 0)
                {
                    m_ChatSpaceCount = (int)((m_ChatInfoItemWidth - space.x) / SPACE_WIDTH);
                    for (int i = 0; i < m_ChatSpaceCount; i++)
                    {
                        bd.Append(Str_Space);
                    }
                    strChatDetail = bd.ToString() + strChatDetail;
                }
            }
        }
        UpdateEmotionLinkPos(history, strChatDetail);

        //调整背景框大小
        if (history.SenderGuid == Singleton <ObjManager> .GetInstance().MainPlayer.GUID)
        {
            if (history.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_TELL)
            {
                m_LabelChatTitleMe.text = StrDictionary.GetClientDictionaryString("#{11440}", history.ReceiverName);
            }
            else
            {
                m_LabelChatTitleMe.text = strChatTitle;
            }
            m_LabelChatDetailMe.text = strChatDetail;
            int     m_LableChatDetailMeWidth = m_ChatInfoItemWidth - m_ChatSpaceCount * SPACE_WIDTH;
            Vector2 m_ChatInfoSpace          = m_Font.CalculatePrintedSize(strChatDetail, true, UIFont.SymbolStyle.Uncolored);
            if (history.SenderGuid != GlobeVar.INVALID_GUID && history.SenderName != "")
            {
                if (m_LableChatDetailMeWidth < m_ChatInfoItemWidth)
                {
                    m_BackgroundMe.width  = Math.Min((int)(m_ChatInfoSpace.x + m_Space_Width * 2), (int)(m_LableChatDetailMeWidth + m_Space_Width * 2));
                    m_ChatMaxHeight       = m_LabelChatDetailMe.printedSize.y;
                    m_BackgroundMe.height = (int)(m_Space_Height);
                }
                else
                {
                    m_BackgroundMe.width  = (int)(m_LableChatDetailMeWidth + m_Space_Width * 2);
                    m_ChatMaxHeight       = m_LabelChatDetailMe.printedSize.y;
                    m_BackgroundMe.height = (int)((m_ChatMaxHeight + m_Space_Height));
                }
            }
            else
            {
                m_BackgroundOthers.gameObject.SetActive(false);
            }
        }
        else
        {
            if (history.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_TELL)
            {
                m_LabelChatTitleOthers.text = StrDictionary.GetClientDictionaryString("#{11441}", history.SenderName);
            }
            else
            {
                m_LabelChatTitleOthers.text = strChatTitle;
            }
            m_LabelChatDetailOthers.text = strChatDetail;
            int     m_LableChatDetailOtherWidth = m_LabelChatDetailOthers.width;
            Vector2 m_ChatInfoSpace             = m_Font.CalculatePrintedSize(strChatDetail, true, UIFont.SymbolStyle.Uncolored);
            if ((history.SenderGuid != GlobeVar.INVALID_GUID && history.SenderName != "") || history.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_SYSTEM)
            {
                if (m_ChatInfoSpace.x < m_LableChatDetailOtherWidth && !strChatDetail.Contains(Environment.NewLine))
                {
                    m_BackgroundOthers.width  = Math.Min((int)(m_ChatInfoSpace.x + m_Space_Width * 2), (int)(m_LableChatDetailOtherWidth + m_Space_Width * 2));
                    m_ChatMaxHeight           = m_LabelChatDetailOthers.printedSize.y;
                    m_BackgroundOthers.height = (int)(m_Space_Height);
                }
                else
                {
                    m_BackgroundOthers.width  = (int)(m_LableChatDetailOtherWidth + m_Space_Width * 2);
                    m_ChatMaxHeight           = m_LabelChatDetailOthers.printedSize.y;
                    m_BackgroundOthers.height = (int)(m_ChatMaxHeight + m_Space_Height);
                }
            }
            else
            {
                m_BackgroundOthers.gameObject.SetActive(false);
            }
        }
    }
Example #7
0
    public void InitCurChat()
    {
        int HistoryCount = GameManager.gameManager.PlayerDataPool.ChatHistory.ChatHistoryList.Count;

        if (HistoryCount > 0)
        {
            int nLastLoudSpeakerIndex = -1;
            List <ChatHistoryItem> listChatHistory = GameManager.gameManager.PlayerDataPool.ChatHistory.ChatHistoryList;
            for (int i = listChatHistory.Count - 1; i >= 0; i--)
            {
                if (listChatHistory[i].EChannel != GC_CHAT.CHATTYPE.CHAT_TYPE_LOUDSPEAKER &&
                    listChatHistory[i].ChatInfo != null &&
                    (listChatHistory[i].ChatInfo != "" || (!PlatformHelper.IsChannelMainland() && listChatHistory[i].VoiceChatIndex != GlobeVar.INVALID_ID)) &&
                    ChatInfoSetupLogic.IsChannelReceiveChat(GameManager.gameManager.PlayerDataPool.ChooseChannel, listChatHistory[i].EChannel))
                {
                    nLastLoudSpeakerIndex = i;
                    break;
                }
            }

            if (nLastLoudSpeakerIndex != -1)
            {
                // 显示聊天信息
                ChatHistoryItem LastHistory = listChatHistory[nLastLoudSpeakerIndex];

                string strChannelName  = Utils.GetChannelName((int)LastHistory.EChannel);
                string strSenderName   = "";
                string strLastChatInfo = LastHistory.ChatInfo;
                if (LastHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_TELL ||
                    LastHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_FRIEND)
                {
                    if (LastHistory.SenderName == Singleton <ObjManager> .Instance.MainPlayer.BaseAttr.RoleName)
                    {
                        //strSenderName = "你对[" + LastHistory.ReceiverName + "]说:";
                        strSenderName = StrDictionary.GetClientDictionaryString("#{2822}", LastHistory.ReceiverName);
                    }
                    else
                    {
                        //strSenderName = "[" + LastHistory.SenderName + "]对你说:";
                        strSenderName = StrDictionary.GetClientDictionaryString("#{2823}", LastHistory.SenderName);
                    }
                    if (strLastChatInfo.Length > 0 && strLastChatInfo[0] == '#')
                    {
                        strLastChatInfo = StrDictionary.GetServerDictionaryFormatString(strLastChatInfo);
                    }
                }
                else if (LastHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_SYSTEM ||
                         LastHistory.EChannel == GC_CHAT.CHATTYPE.CHAT_TYPE_GUILD)
                {
                    if (strLastChatInfo == null)
                    {
                        return;
                    }
                    // 台湾版本需要发送纯语音
                    if (strLastChatInfo == "" && (PlatformHelper.IsChannelMainland() || LastHistory.VoiceChatIndex == GlobeVar.INVALID_ID))
                    {
                        return;
                    }

                    // 系统频道可能无发送人
                    if (LastHistory.SenderGuid != GlobeVar.INVALID_GUID && LastHistory.SenderName != "")
                    {
                        //strSenderName = "[" + LastHistory.SenderName + "]说:";
                        strSenderName = StrDictionary.GetClientDictionaryString("#{2824}", LastHistory.SenderName);
                    }
                    // 解析# 字典
                    if (strLastChatInfo.Length > 0 && strLastChatInfo[0] == '#')
                    {
                        strLastChatInfo = StrDictionary.GetServerDictionaryFormatString(strLastChatInfo);
                    }
                }
                else
                {
                    //strSenderName = "[" + LastHistory.SenderName + "]说:";
                    if (LastHistory.ELinkType.Count > 0 && LastHistory.GetLinkIntDataCountByIndex(0) == (int)GC_CHAT.LINKTYPE.LINK_TYPE_GUILDCRUITE)
                    {
                        strSenderName = "[" + StrDictionary.GetClientDictionaryString("#{3108}", "") + "]:";
                    }
                    else
                    {
                        strSenderName = StrDictionary.GetClientDictionaryString("#{2824}", LastHistory.SenderName);
                    }

                    // 解析# 字典
                    if (strLastChatInfo.Length > 0 && strLastChatInfo[0] == '#')
                    {
                        strLastChatInfo = StrDictionary.GetServerDictionaryFormatString(strLastChatInfo);
                    }
                }

                SelectTextNumber();

                string strChatInfo = strLastChatInfo;
                string strChatFull = strChannelName + strSenderName + strChatInfo;

                strChatFull = ShowVIPIcon(strChatFull, ref strSenderName, LastHistory);
                strChatFull = ShowPlayVoiceBtn(strChatFull, strSenderName, LastHistory);

                if (LastHistory.ELinkType.Count > 0)
                {
                    strChatFull = MakeLinkEnabled(strChatFull, LastHistory);
                }

                strChatFull = MakeEmotionEnabled(strChatFull);

                if (!(LastHistory.ELinkType.Count > 0 && LastHistory.GetLinkIntDataCountByIndex(0) == (int)GC_CHAT.LINKTYPE.LINK_TYPE_GUILDCRUITE))
                {
                    strChatFull = MakeNameLinkEnabled(strChatFull, LastHistory);
                }

                string strChannelColor = Utils.GetChannelColor(LastHistory);
                strChatFull = strChannelColor + strChatFull;

                ConfirmEllipsis(ref strChatFull);
                labelChatText.text = strChatFull;

                UpdateEmotionLinkPos(NGUITools.StripSymbols(strChatFull));
            }
        }
    }
Example #8
0
    public static void UpdateMailData(GC_MAIL_UPDATE data)
    {
        MailUpdateType curUpdateType = MailUpdateType.UPDATE;

        if (m_curPlayGuid != PlayerPreferenceData.LastRoleGUID)
        {
            UserMailMap.Clear();
        }

        m_curPlayGuid = PlayerPreferenceData.LastRoleGUID;

        UserMail curMail = null;

        if (UserMailMap.ContainsKey(data.MailGuid))
        {
            curMail       = UserMailMap[data.MailGuid];
            curUpdateType = MailUpdateType.UPDATE;
        }
        else
        {
            curMail = new UserMail();
            UserMailMap.Add(data.MailGuid, curMail);
            curUpdateType = MailUpdateType.ADD;
        }

        if (RelationLogic.Instance())
        {
            RelationLogic.Instance().ShowNewEmailBigRed();
        }

        if (null == curMail)
        {
            return;
        }

        curMail.key        = data.MailGuid;
        curMail.senderType = (GC_MAIL_UPDATE.MailSender)data.SenderType;
        curMail.SenderID   = data.SenderGuid;
        if (curMail.senderType == GC_MAIL_UPDATE.MailSender.MAILSENDER_SYS)
        {
            if (data.HasOrigin && data.Origin == GlobeVar.MAIL_GUILDMAIL_ORIGIN)
            {
                curMail.SenderName = Utils.GetDicByID(4017);
            }
            else
            {
                curMail.SenderName = Utils.GetDicByID(1363);
            }
            if (!string.IsNullOrEmpty(data.TextContent))
            {
                char firstChar = data.TextContent[0];
                if (firstChar != '#')
                {
                    curMail.text = data.TextContent;
                }
                else
                {
                    curMail.text = StrDictionary.GetServerDictionaryFormatString(data.TextContent);
                }
            }
            else
            {
                curMail.text = "";
            }
        }
        else
        {
            curMail.SenderName = data.SenderName;
            curMail.text       = data.TextContent;
        }

        if (!string.IsNullOrEmpty(curMail.text))
        {
            curMail.text = Utils.StrFilter_Mail(curMail.text);
            curMail.text = Utils.StrFilter_Abuse(curMail.text);
        }


        DateTime startTime = new DateTime(1970, 1, 1);
        DateTime sendDate  = new DateTime((long)data.SendTime * 10000000L + startTime.Ticks, DateTimeKind.Unspecified);

        sendDate           = sendDate.ToLocalTime();
        curMail.time       = sendDate.ToString("yyyy-MM-dd");
        curMail.bReaded    = data.ReadTime > 0;
        curMail.itemID     = data.HasItemID ? data.ItemID : -1;
        curMail.itemCount  = data.HasItemCount ? data.ItemCount : 0;
        curMail.moneyType  = data.HasMoneyType ? data.MoneyType : -1;
        curMail.moneyCount = data.HasMoneyCount ? data.MoneyCount : 0;
        curMail.sortTime   = data.SendTime;

        if (null != delMailUpdate)
        {
            delMailUpdate(curUpdateType, data.MailGuid);
        }
    }