public void jump(SkillXmlData jumpDta, LGAvatarGameInst to_lc) { base.stop(); base.RotationToPt(to_lc.x, to_lc.y); Transform transform = to_lc.gameObj.transform; this.pGameobject.transform.position = transform.position; this.setPos(to_lc.x, to_lc.y); Vector3 position = this.gameObj.transform.position; Vector3 position2 = transform.position; float num = Vector3.Distance(position, position2); Vector3 end = Vector3.Lerp(position, position2, (float)((double)num - 1.5) / num); bool flag = jumpDta.jump_canying != "null"; if (flag) { MapEffMgr.getInstance().playMoveto(jumpDta.jump_canying, position, end, 0.4f); } bool flag2 = jumpDta.eff != "null"; if (flag2) { MapEffMgr.getInstance().play(jumpDta.eff, transform.position, transform.rotation, 0f, null); } }
private bool attackEnemy(LGAvatarGameInst lga, bool smartSkill = false, uint skilid = 0u, bool needjump = false) { Variant data = lga.data; bool flag = !data.ContainsKey("iid"); bool result; if (flag) { result = false; } else { base.operationLgAvatarSet(lga); this._castSkilid = skilid; this._smartSkil = smartSkill; if (smartSkill) { skilid = this.getSkilSmart(); } bool flag2 = skilid > 0u; if (flag2) { result = this.castSkill(skilid, needjump); } else { this._singleAttackFlag = true; uint @uint = data["iid"]._uint; base.play_animation("a16", 2); result = true; } } return(result); }
protected void operationLgAvatarSet(LGAvatarGameInst lga) { bool flag = base.lgMainPlayer.selectTarget != null; if (flag) { } bool flag2 = !base.isMainPlayer(); if (flag2) { base.lgMainPlayer.selectTarget = lga; } bool flag3 = this._selectLgAvatar != null; if (flag3) { this._selectLgAvatar.removeEventListener(2205u, new Action <GameEvent>(this.operationLgaDie)); this._selectLgAvatar.removeEventListener(2285u, new Action <GameEvent>(this.operationLgaDie)); } this._selectLgAvatar = lga; bool flag4 = this._selectLgAvatar == null; if (!flag4) { this._selectLgAvatar.addEventListener(2205u, new Action <GameEvent>(this.operationLgaDie)); this._selectLgAvatar.addEventListener(2285u, new Action <GameEvent>(this.operationLgaDie)); bool flag5 = !this._selectLgAvatar.isMainPlayer(); if (flag5) { } } }
public void playSkillAction(uint sid, string eff = null, LGAvatarGameInst to_lc = null) { bool destroy = base.destroy; if (!destroy) { this._isCastingSkill = true; this._curCastingTm = (float)this.g_mgr.g_netM.CurServerTimeStampMS; bool flag = base.IsMoving(); if (flag) { base.stop(); } bool flag2 = to_lc != null; if (flag2) { bool flag3 = to_lc != this; if (flag3) { base.RotationToPt(to_lc.x, to_lc.y); } } Variant data = this.data; base.play_animation(string.Concat(sid), 1); bool flag4 = eff != null; if (flag4) { MapEffMgr.getInstance().play(eff, this.pGameobject.transform, 450f - this.lg_ori_angle, 0f); } } }
public override void initLg(lgGDBase lgbase) { bool flag = lgbase is LGAvatarGameInst; if (flag) { this.lgAvatar = (lgbase as LGAvatarGameInst); } }
public void useSkill(uint skillid, uint sklvl, bool force = false, LGAvatarGameInst mon = null) { float time = Time.time; bool flag = time - this.lastSkillUseTimer < 0.2f; if (!flag) { this.lastSkillUseTimer = time; lgSelfPlayer instance = lgSelfPlayer.instance; bool flag2 = !instance.canAttack() && !force; if (!flag2) { bool flag3 = mon == null; LGAvatarGameInst lGAvatarGameInst; if (flag3) { lGAvatarGameInst = skillbar.getAttackTarget(9999999); } else { lGAvatarGameInst = mon; } bool flag4 = this.autofighting && lGAvatarGameInst == null; if (!flag4) { bool flag5 = skillid != 1001u; if (flag5) { instance.attack(lGAvatarGameInst, false, skillid); } else { float num = (float)muNetCleint.instance.CurServerTimeStampMS; bool flag6 = this._cur_truns_tm + this._turns_Interval < num || this.curNormalSkillTurn == 2u || (lGAvatarGameInst != null && this.lastIId != lGAvatarGameInst.iid); if (flag6) { bool flag7 = lGAvatarGameInst != null; if (flag7) { this.lastIId = lGAvatarGameInst.iid; } this.curNormalSkillTurn = 0u; } else { this.curNormalSkillTurn += 1u; } uint skillid2 = skillid + this.curNormalSkillTurn; this._cur_truns_tm = num; instance.attack(lGAvatarGameInst, false, skillid2); } } } } }
protected void operationLgAvatarClear() { bool flag = this._selectLgAvatar == null; if (!flag) { this.onOperationLgaClear(); this._selectLgAvatar.removeEventListener(2285u, new Action <GameEvent>(this.operationLgaDie)); this._selectLgAvatar = null; } }
public void rotationToPt(LGAvatarGameInst av) { bool flag = av == null; if (!flag) { Vector3 vector = GRMap.GAME_CAM_CAMERA.WorldToScreenPoint(av.gameObj.transform.position); Vector3 vector2 = GRMap.GAME_CAM_CAMERA.WorldToScreenPoint(lgSelfPlayer.instance.pGameobject.transform.position); float z = (float)(Math.Atan2((double)(vector.y - vector2.y), (double)(vector.x - vector2.x)) * 57.295779513082323) - 90f; this.rect.eulerAngles = new Vector3(0f, 0f, z); } }
private bool isInJumpRange(LGAvatarGameInst avatar) { bool flag = this.jumpSkilld == null; if (flag) { this.jumpSkilld = ModelBase <SkillModel> .getInstance().getSkillData(1008u); } bool flag2 = this.jumpSkilld == null; return(!flag2 && base.IsInRange(avatar, this.jumpSkilld.range, false)); }
protected virtual void playSkill(uint sid, int sex, uint toIID, float tx = 0f, float ty = 0f) { bool destroy = base.destroy; if (!destroy) { SkillXmlData skillXml = ModelBase <SkillModel> .getInstance().getSkillXml(sid); bool flag = skillXml.target_type == 1; if (flag) { LGAvatarGameInst lGAvatarGameInst = base.get_Character_by_iid(toIID); bool useJump = skillXml.useJump; if (useJump) { bool flag2 = lGAvatarGameInst != null; if (flag2) { this.jump(skillXml, lGAvatarGameInst); } } else { bool flag3 = toIID > 0u; if (flag3) { bool flag4 = lGAvatarGameInst != null && lGAvatarGameInst != this; if (flag4) { base.RotationToPt(lGAvatarGameInst.x, lGAvatarGameInst.y); } } this.playSkillAction(sid, (sex == 0) ? skillXml.eff : skillXml.eff_female, lGAvatarGameInst); } } bool flag5 = skillXml.target_type == 2; if (flag5) { bool useJump2 = skillXml.useJump; if (useJump2) { this.jump(skillXml, tx, ty); this.playSkillAction(sid, null, null); } else { base.RotationToPt(tx, ty); this.playSkillAction(sid, (sex == 0) ? skillXml.eff : skillXml.eff_female, null); } } } }
public LGAvatarGameInst get_Character_by_iid(uint iid) { if (iid == selfInfo.mainPlayerInfo["iid"]._uint) { return(lgMainPlayer); } LGAvatarGameInst lga = lgMonsters.get_mon_by_iid(iid); if (lga == null) { lga = lgOthers.get_player_by_iid(iid); } return(lga); }
private void onUpdate(float s) { bool flag = InterfaceMgr.ui_Camera_cam == null || GRMap.GAME_CAM_CAMERA == null; if (!flag) { bool flag2 = this.role == null || this.role.IsDie(); if (flag2) { this.role = LGMonsters.instacne.getNearMon(1000); } bool flag3 = this.role == null; if (flag3) { this.hideIt(); } else { try { bool flag4 = this.role.pGameobject == null; if (flag4) { this.role = null; this.hideIt(); return; } } catch (Exception var_6_9D) { this.role = null; this.hideIt(); return; } LGAvatarGameInst lGAvatarGameInst = this.role; float distance = this.getDistance(lGAvatarGameInst); bool flag5 = lGAvatarGameInst != null && !lGAvatarGameInst.IsDie() && distance > 300f; if (flag5) { this.showIt(); this.rotationToPt(lGAvatarGameInst); } else { this.hideIt(); } } } }
public float getEffAngle(Variant rotate, LGAvatarGameInst frm_lc, LGAvatarGameInst to_lc) { bool flag = rotate == null; float result; if (flag) { result = 0f; } else { float num = 0f; int @int = rotate["tp"]._int; bool flag2 = 1 == @int; if (flag2) { bool flag3 = frm_lc == null || to_lc == null; if (flag3) { result = num; return(result); } Vec2 vec = new Vec2(to_lc.x - frm_lc.x, to_lc.y - frm_lc.y); num = (float)vec.angleBetween(GameConstant.EFF_DEF_ORI); bool flag4 = to_lc.x < frm_lc.x; if (flag4) { num = -num; } } else { bool flag5 = frm_lc == null; if (flag5) { result = num; return(result); } num = (float)(1.5707963267948966 - (double)frm_lc.lg_ori_angle * 3.1415926535897931 / 180.0); } result = num; } return(result); }
private bool attackFriend(LGAvatarGameInst lga, uint skilid) { base.operationLgAvatarSet(lga); bool flag = skilid > 0u; bool result; if (flag) { result = this.castSkill(skilid, false); } else { this._singleAttackFlag = true; uint @uint = this.data["iid"]._uint; base.play_animation("a16", 2); result = true; } return(result); }
public LGAvatarGameInst get_Character_by_iid(uint iid) { bool flag = iid == this.selfInfo.mainPlayerInfo["iid"]._uint; LGAvatarGameInst result; if (flag) { result = this.lgMainPlayer; } else { LGAvatarGameInst lGAvatarGameInst = this.lgMonsters.get_mon_by_iid(iid); bool flag2 = lGAvatarGameInst == null; if (flag2) { lGAvatarGameInst = this.lgOthers.get_player_by_iid(iid); } result = lGAvatarGameInst; } return(result); }
public override bool attack(LGAvatarGameInst lga, bool smartSkill = false, uint skilid = 0u) { bool flag = lga == null; bool result; if (flag) { bool flag2 = skilid > 0u; if (flag2) { this.castSkill(skilid, false); } else { base.play_animation("a16", 1); } result = false; } else { bool flag3 = !smartSkill && skilid <= 0u; if (flag3) { skilid = this.getCurDefSkill(); } SkillData skillData = ModelBase <SkillModel> .getInstance().getSkillData(skilid); bool needjump = false; bool flag4 = skillData.xml.target_type == 1 && !base.isInSkillRange(lga, skillData); if (flag4) { int num = (int)lga.x - (int)this.x; int num2 = (int)lga.y - (int)this.y; } bool flag5 = this.CanAttack(lga); result = (flag5 && this.attackEnemy(lga, smartSkill, skilid, needjump)); } return(result); }
public override void onClosed() { this.role = null; (CrossApp.singleton.getPlugin("processManager") as processManager).removeProcess(this.process, false); base.onClosed(); }
public float getDistance(LGAvatarGameInst avatar) { return(Math.Abs(lgSelfPlayer.instance.x - avatar.x) + Math.Abs(lgSelfPlayer.instance.y - avatar.y)); }
public void onAttchange(Variant msgData) { debug.Log("onAttchange::" + msgData.dump()); BaseRole role = getRole(msgData["iid"]); if (role == null) { return; } //if (msgData.ContainsKey("hpadd") && msgData["hpadd"].ContainsKey("die") && msgData["hpadd"]["die"]._bool) // role.Die(msgData); bool isUser = role.m_isMain; if (msgData.ContainsKey("speed") && role is ProfessionRole) { var pro = (role as ProfessionRole); pro.speed = msgData["speed"]._int; if (isUser) { PlayerModel.getInstance().speed = pro.speed; } } uint frm_iid = 0; LGAvatarGameInst frm_lc = null; if (msgData.ContainsKey("hpchange")) { Variant hpchanged = msgData["hpchange"]; int hpchange = hpchanged["hpchange"]; int curhp = hpchanged["hp_left"]; Variant d = new Variant(); if (isUser) { PlayerModel.getInstance().modHp(curhp); } if (hpchange > 0) { role.modHp(curhp); if (isUser) { FightText.play(FightText.HEAL_TEXT, role.getHeadPos(), hpchange); } if (healEff == null) { healEff = GAMEAPI.ABFight_LoadPrefab("FX_comFX_fuwenFX_FX_fuwen_chuyong"); } if (healEff != null && role is ProfessionRole) { GameObject fx_inst = GameObject.Instantiate(healEff) as GameObject; GameObject.Destroy(fx_inst, 1f); fx_inst.transform.SetParent(role.m_curModel, false); } if (msgData.ContainsKey("rune_ids")) { List <Variant> l = msgData["rune_ids"]._arr; foreach (Variant rune_id in l) { FightText.play(FightText.ADD_IMG_TEXT, role.getHeadPos(), hpchange, false, rune_id); } } } else if (hpchange < 0) { frm_iid = hpchanged["frm_iid"]; BaseRole frm = RoleMgr._instance.getRole(frm_iid); if (msgData.ContainsKey("rune_ids")) { Variant rune = msgData["rune_ids"]; if (rune.Count > 0) { int id_rune = rune[0]; List <Variant> l = msgData["rune_ids"]._arr; foreach (Variant rune_id in l) { role.onServerHurt(-hpchange, curhp, hpchanged["die"], frm, id_rune); } } } } } if (msgData.ContainsKey("mpchange")) { Variant mpchanged = msgData["mpchange"]; int mpchange = mpchanged["mpchange"]; int curmp = mpchanged["mp_left"]; if (isUser) { PlayerModel.getInstance().modMp(curmp); } } if (msgData.ContainsKey("pk_state")) { int pkstate = msgData["pk_state"]; switch (pkstate) { case 0: role.m_ePK_Type = PK_TYPE.PK_PEACE; break; case 1: role.m_ePK_Type = PK_TYPE.PK_PKALL; break; case 2: role.m_ePK_Type = PK_TYPE.PK_TEAM; break; case 3: role.m_ePK_Type = PK_TYPE.PK_LEGION; break; case 4: role.m_ePK_Type = PK_TYPE.PK_HERO; break; case 5: role.m_ePK_Type = PK_TYPE.Pk_SPOET; break; } ; } if (msgData.ContainsKey("clanid")) { role.m_unLegionID = msgData["clanid"]; } if (msgData.ContainsKey("teamid")) { role.m_unTeamID = msgData["teamid"]; if (isUser) { PlayerModel.getInstance().teamid = role.m_unTeamID; PlayerNameUIMgr.getInstance().refeshHpColor(); } else { PlayerNameUIMgr.getInstance().refeshHpColor(role); } } if (msgData.ContainsKey("rune_ids")) { List <Variant> l = msgData["rune_ids"]._arr; foreach (Variant rune_id in l) { GameObject eff = EffMgr.getRuneEff(rune_id._int); if (eff != null) { GameObject fx_inst = GameObject.Instantiate(eff) as GameObject; GameObject.Destroy(fx_inst, 2f); fx_inst.transform.SetParent(role.m_curModel, false); } } //if (!msgData.ContainsKey("hpchange")) //{ // foreach (Variant rune_id in l) // { // FightText.play(FightText.IMG_TEXT, role.getHeadPos(), 0, false, rune_id); // } //} } if (msgData.ContainsKey("sprite_flag")) { uint call = msgData["sprite_flag"]; uint iid = msgData["iid"]; var vv = MonsterMgr._inst.getMonster(iid); if (vv != null) { SkinnedMeshRenderer render = vv.m_curModel.FindChild("body").GetComponent <SkinnedMeshRenderer>(); switch (call) { case 0: foreach (var v in render.sharedMaterials) { v.shader = Shader.Find("A3/A3_Char_Streamer_H"); v.SetColor("_RimColor", new Color(0, 0, 0, 0)); v.SetFloat("_RimWidth", 0f); } break; case 1: render.sharedMaterial = U3DAPI.U3DResLoad <Material>("default/monster_1021_heite_gold"); break; } } } if (isUser == false) { if (msgData.ContainsKey("dress")) { var _role = role as ProfessionRole; _role.rideId = msgData.getValue("dress")._int; if (msgData.getValue("mount")._uint == (uint)RIDESTATE.UP && _role != null) { _role.ridestate = RIDESTATE.UP; if (_role.invisible == false && _role.dianjiTime == -1 && _role.isUp == false) { _role.ChangeRideState(true); } //_role.set_Ride( msgData.getValue( "dress" )._int); } else if (msgData.getValue("mount")._uint == ( uint )RIDESTATE.Down && _role != null) { _role.ridestate = RIDESTATE.Down; _role.Remove_Ride(); } } } //其他玩家坐骑切换 //if (msgData.ContainsKey("speed")) // role.modSpeed(msgData["speed"]._int); //if (msgData.ContainsKey("maxhp")) //{ // int maxhp = msgData["maxhp"]; // role.modMaxHp(maxhp); // if (isUser) // { // PlayerModel.getInstance().max_hp = maxhp; // } //} //if (msgData.ContainsKey("maxdp")) // role.modMaxDp(msgData["maxdp"]._int); //if (msgData.ContainsKey("in_pczone")) //{ // if (role.isMainPlayer()) // { // if (msgData["in_pczone"]._bool) // { // // lgGeneral.PKStateChange(0);需要切换pk模式 lucisa // } // lguiMain.PczoneChange(msgData["in_pczone"]._bool); // } // this.in_pczone = msgData["in_pczone"]._bool; //} //if (msgData.ContainsKey("follow")) //{ // this.follow = msgData["follow"]._bool; //} //if (msgData.ContainsKey("ghost")) //{ // this.ghost = msgData["ghost"]._bool; //} //if (msgData.ContainsKey("ride_mon_id")) //{ // this.ride_mon = msgData["ride_mon_id"];//坐骑 lucisa //} }
public void OnHurt(Variant data, LGAvatarGameInst frm_c) { bool flag = base.isMainPlayer(); bool flag2 = false; bool flag3 = false; bool flag4 = frm_c != null; if (flag4) { flag2 = frm_c.isMainPlayer(); flag3 = (frm_c is LGAvatarHero && ((LGAvatarHero)frm_c).isUserOwnHero); } int id = data.ContainsKey("skill_id") ? data["skill_id"]._int : 0; bool flag5 = data.ContainsKey("isdie") && data["isdie"]._bool; bool flag6 = data.ContainsKey("dmg") && data["dmg"]._int != 0; if (flag6) { int num = -data["dmg"]._int; int num2 = 0; bool flag7 = data.ContainsKey("hprest"); if (flag7) { num2 = data["hprest"]; } bool flag8 = flag; if (flag8) { ModelBase <PlayerModel> .getInstance().modHp(num2); SkillXmlData skillXml = ModelBase <SkillModel> .getInstance().getSkillXml((uint)id); bool hitfall = skillXml.hitfall; if (hitfall) { base.setMeshAni("hitfall", 1); } } else { bool flag9 = this is LGAvatarHero; if (flag9) { uint mid = this.getMid(); } } this.modHp(num2); } else { bool flag10 = data.ContainsKey("hpadd"); if (flag10) { int @int = data["hpadd"]._int; int hprest = data["hprest"]; this.modHp(data["hprest"]); bool flag11 = flag; if (flag11) { ModelBase <PlayerModel> .getInstance().modHp(hprest); } } } bool flag12 = flag5; if (flag12) { bool flag13 = !flag2 && !flag3; if (flag13) { this.Die(data); } } bool flag14 = this._isCastingSkill && this._curCastingTm + this._castingTm < (float)this.g_mgr.g_netM.CurServerTimeStampMS; if (flag14) { this._isCastingSkill = false; } bool flag15 = !flag && (flag2 | flag3); if (flag15) { data["hurteff"] = true; } }
virtual public bool attack(LGAvatarGameInst lg, bool smartSkill = false, uint skillid = 0) { return(false); }
private bool CanAttack(LGAvatarGameInst lga) { bool flag = lga == null; bool result; if (flag) { result = false; } else { bool flag2 = base.IsDie() || lga.IsDie(); if (flag2) { result = false; } else { Variant data = this.data; Variant data2 = lga.data; uint @uint = data["cid"]._uint; bool flag3 = lga is LGAvatarMonster; if (flag3) { bool flag4 = lga.IsCollect(); if (flag4) { result = false; return(result); } bool flag5 = data2.ContainsKey("owner_cid"); if (flag5) { uint uint2 = data2["owner_cid"]._uint; bool flag6 = uint2 == @uint; if (flag6) { result = false; return(result); } LGAvatarGameInst lGAvatarGameInst = base.lgOthers.get_player_by_cid(uint2); bool flag7 = lGAvatarGameInst != null; if (!flag7) { result = false; return(result); } data2 = lGAvatarGameInst.data; bool flag8 = data2 == null || data2["level"]._uint < 50u; if (flag8) { result = false; return(result); } } } result = true; } } return(result); }
private bool isFriend(LGAvatarGameInst lga) { return(lga.getIid() == this.getIid()); }
public void movePosSingle(float tx, float ty, Action <Variant> onMoveReach, Variant userData = null, float range = 0f, LGAvatarGameInst target = null) { }