public void OnFriendRecvAllBlessResp(int energy, LuaTable luaTable, int msg) { Debug.Log("OnFriendRecvAllBlessResp:" + msg); if (msg == ERROR_FRIEND_SUCCESS) { List <TDBID> obj; if (Utils.ParseLuaTable(luaTable, out obj)) { foreach (TDBID id in obj) { FriendMessageGridData fd = GetFriendInfo(id); fd.isWishByFriend = false; IsfriendListDirty = true; } } int msgid = ContentDefine.Friend.TEXT_RECV_ALL_BLESS_SUCCEED; if (LanguageData.dataMap.ContainsKey(msgid)) { string s = LanguageData.GetContent(msgid, energy);//dataMap[msgid].Format(energy); ShowText(2, s); } IsfriendListDirty = true; SocietyUIViewManager.Instance.RefreshFriendList(); SocietyUIViewManager.Instance.AddOneKeyGetBlessListUnit(obj); return; } OnFriendErrorResp((byte)msg); }
/// <summary> /// 祝福好友成功 /// </summary> /// <param name="friendId"></param> public void OnFriendBlessResp(TDBID friendId) { Debug.Log("OnFriendBlessResp:" + friendId); FriendMessageGridData gridData = GetFriendInfo(friendId); if (gridData != null) { gridData.isWithToFriend = true; IsfriendListDirty = true; SocietyUIViewManager.Instance.RefreshFriendList(); } }
public void OnFriendRecvBlessResp(int energy, TDBID friendId, int msg) { Debug.Log("OnFriendRecvBlessResp:" + msg); if (msg == ERROR_FRIEND_SUCCESS) { int id = ContentDefine.Friend.RECV_WISH_SUCCEED; if (LanguageData.dataMap.ContainsKey(id)) { string s = LanguageData.GetContent(id, energy);//dataMap[id].Format(energy); ShowText(1, s); } FriendMessageGridData fd = GetFriendInfo(friendId); fd.isWishByFriend = false; } //因为体力图标消失,重新刷一次 IsfriendListDirty = true; SocietyUIViewManager.Instance.RefreshFriendList(); OnFriendErrorResp((byte)msg); }
public void FriendReadNoteResp(LuaTable luaTable, int msg) { Debug.Log("FriendReadNoteResp: " + msg); if (msg != ERROR_FRIEND_SUCCESS) { return; } List <FriendNoteData> obj; if (Utils.ParseLuaTable(luaTable, out obj)) { if (obj.Count < 1) { return; } FriendMessageGridData fd = GetFriendInfo(obj[0].id); string name = fd.name; fd.isMessage = false; IsfriendListDirty = true; SocietyUIViewManager.Instance.RefreshFriendMessageList(name, obj); } }
/// <summary> /// 好友列表 /// </summary> /// <param name="luaTable"></param> /// <param name="msg"></param> public void FriendListResp(LuaTable luaTable, int msg) { List <FriendData> friendData; if (Utils.ParseLuaTable(luaTable, out friendData)) { //Debug.Log("ParseLuaTable friends succeed."); //SocietyUIViewManager.Instance.SetFriendList(args); /* * Comparison<FriendData> com = new Comparison<FriendData>( * (a, b) => * { * if (a.IsNote > 0 && b.IsNote == 0) * { * return -1; * } * else if (a.IsNote == 0 && b.IsNote > 0) * { * return 1; * } * else * { * return b.fight - a.fight; * } * } * ); * friendData.Sort(com); */ m_friendList.Clear(); foreach (FriendData fd in friendData) { FriendMessageGridData fm = new FriendMessageGridData(); fm.id = fd.id; if (fd.IsOnline != 0) { fm.headImg = "";//base on the fd.vocation and fd.IsOnline } if (fd.degree < 10) { fm.degreeNum = 1; } else if (fd.degree < 25) { fm.degreeNum = 2; } else if (fd.degree < 45) { fm.degreeNum = 3; } else if (fd.degree < 70) { fm.degreeNum = 4; } else { fm.degreeNum = 5; } fm.name = fd.name; fm.level = Convert.ToString(fd.level); fm.power = Convert.ToString(fd.fight); fm.isMessage = fd.IsNote == 0 ? false: true; fm.isWishByFriend = fd.IsBlessedByFriend == 0 ? false : true; fm.isWithToFriend = fd.IsBlessedToFriend == 0 ? false : true; fm.isOnline = fd.IsOnline == 0 ? true : false; switch (fd.vocation) { case 1: { fm.headImg = "zhanshi"; break; } case 2: { fm.headImg = "cike"; break; } case 3: { fm.headImg = "gongjianshou"; break; } default: { fm.headImg = "fashi"; break; } } m_friendList.Add(fm); } IsfriendListDirty = true; if (SocietyUIViewManager.Instance) { SocietyUIViewManager.Instance.RefreshFriendList(); } else { FreshTipUI(); } } else { Debug.Log("ParseLuaTable friends failed."); } }
void OnSendButtonUp() { if (CommunityUIViewManager.Instance.GetChatUILogicText() == "") { return; } if (CommunityUIViewManager.Instance.GetInputLabelContentLength() > 50) { //MogoFXManager.Instance.FloatText("Too Many Words..."); MogoMsgBox.Instance.ShowFloatingText(LanguageData.GetContent(7527)); return; } if (m_bIsSendCDing) { //MogoFXManager.Instance.FloatText("Slow Down Please..."); MogoMsgBox.Instance.ShowFloatingText(LanguageData.GetContent(7526)); return; } TimerHeap.AddTimer(5000, 0, () => { m_bIsSendCDing = false; }); Debug.Log("Send"); m_bIsSendCDing = true; //TimerHeap.AddTimer(3000, 0, () => { m_bIsSendCDing = false; }); //if (m_iCurrentChannel == 2) //{ // EventDispatcher.TriggerEvent<string>("SendCommunityMessage", // m_iCurrentChannel + m_strFriendId + CommunityUIViewManager.Instance.GetChatUILogicText().Substring(m_iPrivateTalkHead)); //} //else //{ // EventDispatcher.TriggerEvent<string>("SendCommunityMessage", // m_iCurrentChannel + CommunityUIViewManager.Instance.GetChatUILogicText().Substring(m_iPrivateTalkHead)); //} string data = CommunityUIViewManager.Instance.GetChatUILogicText().Replace("\\n", ""); data = data.Replace("[", "["); data = data.Replace("]", "]"); for (int i = 0; i < data.Length; ++i) { if (data[i] == '<') { if (data.Length > i + 6) { if (data.Substring(i, 7) == "<info=(") { if (data.Length > i + 13) { string itemId = data.Substring(i + 7, 7); if (InventoryManager.Instance.GetItemByItemID(int.Parse(itemId), true) == null) { MogoMsgBox.Instance.ShowFloatingText("Not Have This Item"); return; } } } } } } if (m_iCurrentChannel == ChannelId.PERSONAL) { string chatStr = data.Substring(m_iPrivateTalkHead); if (chatStr.Length > 0 && chatStr[chatStr.Length - 1] == '|') { chatStr = chatStr.Substring(0, chatStr.Length - 1); } //Debug.LogError(m_strFriendId); MogoWorld.thePlayer.RpcCall("Chat", (byte)m_iCurrentChannel, (ulong)m_strFriendId, chatStr); if (m_dictIDToName.ContainsKey(m_strFriendId)) { string sendLevel = ""; FriendMessageGridData friendMessageGridData = FriendManager.Instance.GetFriendInfo(m_strFriendId); if (friendMessageGridData != null) // 私聊-好友等级 { sendLevel = friendMessageGridData.level; } else if (m_dictIDToLevel.ContainsKey(m_strFriendId))// 私聊-非好友等级 { sendLevel = m_dictIDToLevel[m_strFriendId].ToString(); } else { sendLevel = "**"; } string LvAndNameString = ""; if (MogoUIManager.IsShowLevel) { LvAndNameString = string.Concat("[", NAME_COLOR, "]", "LV", sendLevel, " ", m_dictIDToName[m_strFriendId], "[-]"); } else { LvAndNameString = string.Concat("[", NAME_COLOR, "]", m_dictIDToName[m_strFriendId], "[-]"); } //CommunityUIViewManager.Instance.AddChatUIDialogText("[" + PERSONAL_COLOR + "][" + LanguageData.GetContent(47302) + "] : 你对" + LvAndNameString + "说 : " + chatStr + "[-]", ChannelId.PERSONAL, (ulong)m_strFriendId); CommunityUIViewManager.Instance.AddChatUIDialogText("[" + PERSONAL_COLOR + "]" + CHANNEL_BLANK + LanguageData.GetContent(47305) + LvAndNameString + LanguageData.GetContent(47306) + chatStr + "[-]", ChannelId.PERSONAL, (ulong)m_strFriendId, ChannelId.PERSONAL, LvAndNameString, NAME_COLOR, 105); } m_lastWords = data.Substring(m_iPrivateTalkHead); //MogoWorld.thePlayer.RpcCall("Chat", (byte)m_iCurrentChannel, (uint)m_strFriendId, // CommunityUIViewManager.Instance.GetChatUILogicText().Substring(m_iPrivateTalkHead)); } else { //string chatStr = data.Substring(m_iPrivateTalkHead); string chatStr = data; if (chatStr.Length > 0 && chatStr[chatStr.Length - 1] == '|') { chatStr = chatStr.Substring(0, chatStr.Length - 1); } MogoWorld.thePlayer.RpcCall("Chat", (byte)m_iCurrentChannel, (ulong)0, chatStr); m_lastWords = data; //MogoWorld.thePlayer.RpcCall("Chat", (byte)m_iCurrentChannel, (uint)0, // CommunityUIViewManager.Instance.GetChatUILogicText().Substring(m_iPrivateTalkHead)); } EventDispatcher.TriggerEvent <string>(Events.OtherEvent.ClientGM, m_lastWords); m_iPrivateTalkHead = 0; CommunityUIViewManager.Instance.EmptyChatUIInput(); }
public void AddFriendGrid(FriendMessageGridData fd) { AssetCacheMgr.GetUIInstance("FriendItem.prefab", (prefab, id, go) => { GameObject obj = (GameObject)go; obj.GetComponentsInChildren<MyDragCamera>(true)[0].RelatedCamera = m_camFriendGridList; obj.transform.parent = m_goFriendGridList.transform; obj.transform.localPosition = new Vector3(0, -m_listFriendGrid.Count * 105, 0); obj.transform.localScale = new Vector3(1, 1, 1); //FriendMessageGrid fg = obj.GetComponentsInChildren<FriendMessageGrid>(true)[0]; FriendMessageGrid fg = obj.AddComponent<FriendMessageGrid>(); fg.Id = fd.id; fg.WishStrenth = fd.isWishByFriend; if (fd.isWishByFriend && !m_RecvAllButtun.activeSelf) { m_RecvAllButtun.SetActive(true); } fg.LevelMessage = fd.isMessage; fg.HasWish = fd.isWithToFriend; fg.DegreeNum = fd.degreeNum; //fg.FightingPower = LanguageData.dataMap[ContentDefine.Friend.POWER].Format(fd.power); fg.FightingPower = LanguageData.GetContent(ContentDefine.Friend.POWER, fd.power); fg.FriendHeadImg = fd.headImg; //fg.FriendLevel = LanguageData.dataMap[ContentDefine.Friend.LV].Format(fd.level); fg.FriendLevel = LanguageData.GetContent(ContentDefine.Friend.LV, fd.level); fg.FriendName = fd.name; if (fd.isOnline) { //todo:在线显示 } else { //todo:离线提示 } m_listFriendGrid.Add(obj); obj.GetComponentsInChildren<MogoSingleButton>(true)[0].ButtonListTransform = m_goFriendGridList.transform; m_goFriendGridList.transform.GetComponentsInChildren<MogoSingleButtonList>(true)[0].SingleButtonList.Add(obj.GetComponentsInChildren<MogoSingleButton>(true)[0]); //obj.GetComponentsInChildren<MyDragCamera>(true)[0].RelatedCamera = m_camFriendGridList; if (m_listFriendGrid.Count >= 4) { m_camFriendGridList.GetComponentsInChildren<MyDragableCamera>(true)[0].MINY = -158 - 105 * (m_listFriendGrid.Count - 4); } else { m_camFriendGridList.GetComponentsInChildren<MyDragableCamera>(true)[0].MINY = -158; } }); }
/// <summary> /// 好友列表 /// </summary> /// <param name="luaTable"></param> /// <param name="msg"></param> public void FriendListResp(LuaTable luaTable, int msg) { List<FriendData> friendData; if (Utils.ParseLuaTable(luaTable, out friendData)) { LoggerHelper.Debug("ParseLuaTable friends succeed."); //SocietyUIViewManager.Instance.SetFriendList(args); /* Comparison<FriendData> com = new Comparison<FriendData>( (a, b) => { if (a.IsNote > 0 && b.IsNote == 0) { return -1; } else if (a.IsNote == 0 && b.IsNote > 0) { return 1; } else { return b.fight - a.fight; } } ); friendData.Sort(com); */ m_friendList.Clear(); foreach (FriendData fd in friendData) { FriendMessageGridData fm = new FriendMessageGridData(); fm.id = fd.id; if (fd.IsOnline != 0) { fm.headImg = "";//base on the fd.vocation and fd.IsOnline } if (fd.degree < 10) fm.degreeNum = 1; else if (fd.degree < 25) fm.degreeNum = 2; else if (fd.degree <45) fm.degreeNum = 3; else if (fd.degree < 70) fm.degreeNum = 4; else fm.degreeNum = 5; fm.name = fd.name; fm.level = Convert.ToString(fd.level); fm.power = Convert.ToString(fd.fight); fm.isMessage = fd.IsNote == 0 ? false: true; fm.isWishByFriend = fd.IsBlessedByFriend == 0 ? false : true; fm.isWithToFriend = fd.IsBlessedToFriend == 0 ? false : true; fm.isOnline = fd.IsOnline == 0 ? true : false; switch (fd.vocation) { case 1: { fm.headImg = "zhanshi"; break; } case 2: { fm.headImg = "cike"; break; } case 3: { fm.headImg = "gongjianshou"; break; } default: { fm.headImg = "fashi"; break; } } m_friendList.Add(fm); } IsfriendListDirty = true; if (SocietyUIViewManager.Instance) { SocietyUIViewManager.Instance.RefreshFriendList(); } else { FreshTipUI(); } } else { LoggerHelper.Debug("ParseLuaTable friends failed."); } }