public void SetLegion(Legion _legion, bool bSendData = false) { legion = _legion; if (bSendData) { SendLegionInfo(); } }
public void Init(Legion _legion = null) { if (_legion != null) { legion = _legion; return; } legion = LegionManager.Instance().GetPlayerLegion(play.GetName()); }
public void DB_Load(LEGIONINFO info) { mDicLegion.Clear(); for (int i = 0; i < info.list_item.Count; i++) { Legion obj = new Legion(); obj.SetBaseInfo(info.list_item[i]); mDicLegion[info.list_item[i].id] = obj; } Log.Instance().WriteLog("从DBserver加载军团数据库成功!"); }
//更改成员职位 public void ChangeMemberPlace(uint legion_id, String play_name, short place) { Legion legion = GetLegion(legion_id); for (int i = 0; i < legion.GetBaseInfo().list_member.Count; i++) { if (legion.GetBaseInfo().list_member[i].members_name == play_name) { legion.GetBaseInfo().list_member[i].rank = place; break; } } }
public void UpdateLegionInfo(uint legion_id, int player_id) { if (!mDicLegion.ContainsKey(legion_id)) { return; } Legion info = mDicLegion[legion_id]; //发送给dbserver 更新军团数据 LegionOption option = new LegionOption(); option.SetUpdateTag(); option.player_id = player_id; option.mInfo = info.GetBaseInfo(); DBServer.Instance().GetDBClient().SendData(option.GetBuffer()); }
//创建军团返回 public void CreateLegion_Ret(CreateLegion_Ret info) { LegionInfo le = null; for (int i = 0; i < mListTemp.Count; i++) { if (mListTemp[i].leader_id == info.play_id) { le = mListTemp[i]; le.id = (uint)info.legion_id; mListTemp.Remove(le); break; } } if (info == null || info.ret == 0 || le == null) { return; } PlayerObject play = UserEngine.Instance().FindPlayerObjectToPlayerId(info.play_id); if (play == null) { return; } //加入军团长 LegionMember member = new LegionMember(); member.boChange = true; member.members_name = play.GetName(); member.money = info.money; member.id = info.boss_id; member.rank = GameBase.Config.Define.LEGION_PLACE_JUNTUANZHANG; le.list_member.Add(member); Legion l = new Legion(); l.SetBaseInfo(le); mDicLegion[le.id] = l; play.GetLegionSystem().SetLegion(l, true); }
//退出军团 public void QuitLegion(PlayerObject play) { Legion legion = play.GetLegionSystem().GetLegion(); if (legion == null) { return; } uint legion_id = legion.GetBaseInfo().id; play.GetLegionSystem().SetLegion(null, true); int player_id = play.GetBaseAttr().player_id; for (int i = 0; i < legion.GetBaseInfo().list_member.Count; i++) { if (legion.GetBaseInfo().list_member[i].members_name == play.GetName()) { legion.GetBaseInfo().list_member[i].id = 0; break; } } this.UpdateLegionInfo(legion_id, player_id); }
//军团添加成员 public void AddMember(uint legion_id, PlayerObject play) { //已经有军团了 if (play.GetLegionSystem().IsHaveLegion()) { return; } Legion legion = GetLegion(legion_id); if (legion == null) { return; } LegionMember member = new LegionMember(); member.members_name = play.GetName(); member.money = 0; member.rank = GameBase.Config.Define.LEGION_PLACE_PUTONGTUANYUAN; legion.GetBaseInfo().list_member.Add(member); play.GetLegionSystem().SetLegion(legion, true); UpdateLegionInfo(legion_id, play.GetBaseAttr().player_id); }
//创建军团返回 public void CreateLegion_Ret(CreateLegion_Ret info) { LegionInfo le = null; for(int i = 0;i < mListTemp.Count;i++) { if (mListTemp[i].leader_id == info.play_id) { le = mListTemp[i]; le.id = (uint)info.legion_id; mListTemp.Remove(le); break; } } if(info == null || info.ret ==0 || le == null)return; PlayerObject play = UserEngine.Instance().FindPlayerObjectToPlayerId(info.play_id); if (play == null) return; //加入军团长 LegionMember member = new LegionMember(); member.boChange = true; member.members_name = play.GetName(); member.money = info.money; member.id = info.boss_id; member.rank = GameBase.Config.Define.LEGION_PLACE_JUNTUANZHANG; le.list_member.Add(member); Legion l = new Legion(); l.SetBaseInfo(le); mDicLegion[le.id] = l; play.GetLegionSystem().SetLegion(l,true); }
public PlayerLegion(PlayerObject _play) { legion = null; play = _play; }
public void SetLegion(Legion _legion,bool bSendData = false) { legion = _legion; if (bSendData) { SendLegionInfo(); } }