//设置我自己相关信息 private void SetMyInfo() { FriendLogic logic = FriendLogic.getInstance(); ArrayList friendList = logic.GetFriendList(); //好友集合 ArrayList enemyList = logic.getEnemyList(); //敌人集合 //设置我image MajorPlayer majorPlayer = PlayerManager.GetInstance().MajorPlayer; imageSign.atlas = headAtlas; KGender gender = EnumUtils.GetEnumIns <KGender>(majorPlayer.Gender); if (gender == KGender.gFemale) { imageSign.spriteName = "女主"; } else { imageSign.spriteName = "男主"; } //show my nickname level nameLab.text = majorPlayer.PlayerName; levelLab.text = "等级:" + majorPlayer.level; //show my sort sortLab.text = "我的好友 [" + friendList.Count + "/" + logic.Friend_MaxNum + "] 你等级排名:100"; }
private void createFriendLab() { FriendLogic logic = FriendLogic.getInstance(); FriendInfo info = null; ArrayList friendList = logic.GetFriendList(); //好友集合 image = new UISprite[friendList.Count]; //好友头像 infoLab = new UILabel[friendList.Count]; //好友介绍 infoBg = new UISprite[friendList.Count]; //好友背景 for (int i = 0; i < friendList.Count; i++) { info = friendList[i] as FriendInfo; image[i] = NGUITools.AddChild <UISprite>(GameObject.Find("friend")); image[i].transform.localPosition = new Vector3(-170.3591f, -35.93111f + (-55) * i, 0); image[i].transform.localScale = new Vector3(1, 1, 1); image[i].atlas = headAtlas; image[i].width = 46; image[i].height = 44; if (info.sex == KGender.gFemale) { image[i].spriteName = "女主"; } else { image[i].spriteName = "男主"; } image[i].depth = 10 + i; //先设置label infoLab[i] = NGUITools.AddChild <UILabel>(GameObject.Find("friend")); infoLab[i].transform.localPosition = new Vector3(-140f, -35.93111f + (-55) * i, 0); infoLab[i].font = FontManager.GetInstance().Font; infoLab[i].text = info.nickName + " " + info.level + "级"; infoLab[i].transform.localScale = new Vector3(1, 1, 1); infoLab[i].pivot = UIWidget.Pivot.BottomLeft; infoLab[i].depth = 30 + i; infoLab[i].MakePixelPerfect(); infoBg[i] = NGUITools.AddChild <UISprite>(GameObject.Find("friend")); infoBg[i].transform.localPosition = new Vector3(-140f, -35.93111f + (-55) * i, 0); infoBg[i].transform.localScale = new Vector3(1, 1, 1); infoBg[i].pivot = UIWidget.Pivot.BottomLeft; infoBg[i].atlas = friendAtlas; infoBg[i].spriteName = "friendbg"; infoBg[i].width = infoLab[i].width; infoBg[i].height = infoLab[i].height; infoBg[i].depth = 20 + i; } }
//删除仇人 private void OnRemoveEnemy(ulong roleID) { FriendLogic.getInstance().OnRemoveEnemy(roleID); }
//增加仇人 private void OnAddEnemy(ulong roleID, string roleName, int roleLevel, bool onLine) { FriendLogic.getInstance().OnAddEnemy(roleID, roleName, roleLevel, onLine); }
//增加好友申请消息 private void OnAddApplyFriendMsg(ulong senderID, string nickName, int level) { FriendLogic.getInstance().OnAddApplyFirendMsg(senderID, nickName, level); }
//仇人达到上限 private void OnMaxEnemyNotify() { FriendLogic.getInstance().OnMaxEnemyNotify(); }
//删除好友 private void OnRemoveFriend(ulong friendID) { FriendLogic.getInstance().OnRemoveFriend(friendID); }
//提示已经是好友 private void OnAlreadyMyFriend(string friendName) { FriendLogic.getInstance().OnAlreadyMyFriend(friendName); }
//private void OnHeartBeat(int nCurFrame, ulong uid, RemoteTable tab) //{ // log.Debug("xxxxxxxx" + uid + " "+ nCurFrame + tab[1] + tab["xxx"]); //} //增加好友 private void OnAddFriend(ulong friendID, string friendName, int friendLevel, bool onLine) { FriendLogic.getInstance().OnAddFriend(friendID, friendName, friendLevel, onLine); }
//同步仇人在线状态 private void OnEnemyOnLineStatus(ulong roleID, bool status) { FriendLogic.getInstance().OnEnemyOnLineStatus(roleID, status); }
//同步仇人的等级 private void OnUpdateEnemyLevel(ulong roleID, int roleLevel) { FriendLogic.getInstance().OnUpdateEnemyLevel(roleID, roleLevel); }
//同步好友 private void OnSyncFriends(RemoteTable tab) { FriendLogic.getInstance().OnSyncFriends(tab); }
//提示已经是我仇人 private void OnAlreadyMyEnemy(string enemyName) { FriendLogic.getInstance().OnAlreadyMyEnemy(enemyName); }