private void onSpriteLeaveZone(GameEvent e) { Variant data = e.data; foreach (uint iid in data["iidary"]._arr) { if (!_playerShowInfosByIid.ContainsKey(iid)) { continue; } //DebugTrace.print( " player onSpriteLeaveZone:" + iid ); Variant pinfo = _playerShowInfosByIid[iid]; uint cid = pinfo["cid"]._uint; _playerShowInfosByIid.Remove(iid); if (_playersByIid.ContainsKey(iid)) { LGAvatarOther ct = _playersByIid[iid]; _playersByIid.Remove(iid); _playersByCid.Remove(cid); ct.dispose(); } } }
private void onSpriteLeaveZone(GameEvent e) { Variant data = e.data; using (List <Variant> .Enumerator enumerator = data["iidary"]._arr.GetEnumerator()) { while (enumerator.MoveNext()) { uint key = enumerator.Current; bool flag = !this._playerShowInfosByIid.ContainsKey(key); if (!flag) { Variant variant = this._playerShowInfosByIid[key]; uint @uint = variant["cid"]._uint; this._playerShowInfosByIid.Remove(key); bool flag2 = this._playersByIid.ContainsKey(key); if (flag2) { LGAvatarOther lGAvatarOther = this._playersByIid[key]; this._playersByIid.Remove(key); this._playersByCid.Remove(@uint); lGAvatarOther.dispose(); } } } } }
private void createPlayer(Variant m) { uint iid = m["iid"]._uint; uint cid = m["cid"]._uint; LGAvatarOther ct = new LGAvatarOther(this.g_mgr); _playersByIid[iid] = ct; _playersByCid[cid] = ct; //if( info.ContainsKey("moving") ) //{ // //DebugTrace.print("other player todo moving!"); //} //if( info.ContainsKey( "atking" ) ) //{ // //DebugTrace.print("other player todo atking!"); //} //if( info.ContainsKey( "states" ) ) //{ // //DebugTrace.print("other player todo states!"); //} ct.initData(m); ct.init(); this.g_mgr.g_processM.addRender(ct); }
private void createPlayer(Variant m) { uint @uint = m["iid"]._uint; uint uint2 = m["cid"]._uint; LGAvatarOther lGAvatarOther = new LGAvatarOther(this.g_mgr); this._playersByIid[@uint] = lGAvatarOther; this._playersByCid[uint2] = lGAvatarOther; lGAvatarOther.initData(m); lGAvatarOther.init(); this.g_mgr.g_processM.addRender(lGAvatarOther, false); }
public LGAvatarOther getNearPlayer(int range = 1000) { bool flag = this._playersByIid == null || this._playersByIid.Values == null; LGAvatarOther result; if (flag) { result = null; } else { LGAvatarOther lGAvatarOther = null; float num = 1000f; int num2 = lgSelfPlayer.instance.viewInfo["x"]; int num3 = lgSelfPlayer.instance.viewInfo["y"]; foreach (LGAvatarOther current in this._playersByIid.Values) { bool flag2 = current.IsDie(); if (!flag2) { bool flag3 = current.IsCollect(); if (!flag3) { float num4 = Math.Abs(current.x - (float)num2) + Math.Abs(current.y - (float)num3); bool flag4 = num4 > (float)range; if (!flag4) { bool flag5 = lGAvatarOther == null && !current.IsDie(); if (flag5) { lGAvatarOther = current; num = num4; } else { bool flag6 = num > num4 && !current.IsDie(); if (flag6) { lGAvatarOther = current; num = num4; } } } } } } result = lGAvatarOther; } return(result); }
public LGAvatarOther getNearPlayer(int range = 1000) { if (_playersByIid == null || _playersByIid.Values == null) { return(null); } LGAvatarOther charPlayer = null; float curdis = 1000f; int x = lgSelfPlayer.instance.viewInfo["x"]; int y = lgSelfPlayer.instance.viewInfo["y"]; foreach (LGAvatarOther ct in _playersByIid.Values) { if (ct.IsDie()) { continue; } if (ct.IsCollect()) { continue; } float dis = Math.Abs(ct.x - x) + Math.Abs(ct.y - y); if (dis > range) { continue; } if (charPlayer == null && !ct.IsDie()) { charPlayer = ct; curdis = dis; } // else if (Math.Abs((charMon.x - x) * (charMon.x - x)) + Math.Abs((charMon.y - y) * (charMon.y - y)) > Math.Abs((ct.x - x) * (ct.x - x)) + Math.Abs((ct.y - y) * (ct.y - y))) else if (curdis > dis && !ct.IsDie()) { charPlayer = ct; curdis = dis; } } return(charPlayer); }
public void disposeChar(uint iid) { LGAvatarOther lGAvatarOther = this._playersByIid[iid]; lGAvatarOther.dispose(); }
public void onSelectOther(LGAvatarOther other) { }
public void disposeChar(uint iid) { LGAvatarOther ct = _playersByIid[iid]; ct.dispose(); }