void Awake() { _instance = this; // GUITools.ResterWindowAction(new Rect(300, 0, 220, 120), delegate(GUIAction action) // { // action.Rect = GUI.Window(action.Id, action.Rect, delegate // { // action.Param[0] = GUI.TextField(new Rect(10, 20, 200, 20), action.Param[0]); // action.Param[1] = GUI.TextField(new Rect(10, 45, 200, 20), action.Param[1]); // if (GUI.Button(new Rect(10, 70, 200, 30), "AddBuff")) // { // if (TestActor == null || !TestActor.gameObject.Equals(action.Param[1])) // { // GameObject obj = GameObject.Find(action.Param[1]); // if (obj != null) // TestActor = obj.GetComponent<Actor>(); // } // if (TestActor != null) // DoBuff(TestActor, int.Parse(action.Param[0])); // else // GUI.Label(new Rect(10, 105, 200, 10), "测试Actor 为 null ,请检查Actor Name是否正确!"); // } // GUI.DragWindow(); // }, action.Id+ " - Buff Test|BuffManager"); // },"0","Player"); }
public void OnReturnSpawnPoint() { if (IsMoving) { return; } //清除buff BuffMgr.ClearUp(); //yzb 根据不同怪的类型,回血速度 if (Type == CSCommon.eNpcType.Point) { } else { //回复生命 CurHP = FinalRoleValue.MaxHP; } if (!SelectTarget()) { ChangeState(eNPCState.Idle); } }
public Role(int player_id) : base(player_id) { this.equip_mgr = new EquipMgr(this); this.skill_mgr = new SkillMgr(this); this.buff_mgr = new BuffMgr(this); this.state_mgr = new StateMgr(this); }
//创建Buff public Buff(BuffMgr mgr, FightUnit caster, int sklLevel, uint uid, int tplId, Vector2 effect) { JObject cbuff = JsonMgr.GetSingleton().GetBuff(tplId); int type = cbuff["type"].ToObject <int>(); int priority = cbuff["priority"].ToObject <int>(); this.UID = uid; this.BuffId = tplId; this.Mgr = mgr; this.Priority = priority; this.BuffLevel = sklLevel; this.AccTime = 0; this.BuffTime = cbuff["bufftime"].ToObject <float>(); this.IsTriggered = false; this.Desc = cbuff["desc"].ToObject <string>(); switch (type) { case (int)BuffType.Time: { this.Type = BuffType.Time; } break; case (int)BuffType.Times: { this.Type = BuffType.Times; this.UseTimes = cbuff["usetimes"].ToObject <int>(); this.BuffCD = cbuff["buffcd"].ToObject <float>(); this.AccBuffCD = 0; } break; case (int)BuffType.Trigger: { this.Type = BuffType.Trigger; this.Trigger = cbuff["trigger"].ToObject <int>(); this.TriggerParam = cbuff["triggerparam"].ToObject <float>(); } break; case (int)BuffType.Shield: { this.Type = BuffType.Shield; this.ShieldHP = (int)effect.y; } break; default: break; } this.EffectParam = effect; this.Caster = caster; }
/// <summary> /// 重新计算影响值 /// </summary> public void ReComputeAffectValue() { foreach (var p in mEffectValue) { if (p.value == 0) { continue; } eBuffEffectType type = (eBuffEffectType)p.type; float tempValue = p.value; SetEffectValue(type, tempValue); if (LogicType == eBuffLogicType.Fixed) { BuffMgr.RefreshAffectValue(type); } } }
/// <summary> /// 删除buff触发 /// </summary> public void OnBuffEnd() { if (LogicType == eBuffLogicType.Static) { return; } if (LogicType == eBuffLogicType.Fixed) { foreach (var p in mEffectValue) { BuffMgr.RefreshAffectValue((eBuffEffectType)p.type); } } if (Data.type == (int)eBuffEffectType.免疫控制) { Owner.PlayerStatus.DelmmunityType((int)eImmunityType.眩晕); Owner.PlayerStatus.DelmmunityType((int)eImmunityType.击飞); Owner.PlayerStatus.DelmmunityType((int)eImmunityType.击跪); } }
// Use this for initialization protected virtual void Start() { _actionMgr = new ActionMgr(); _commandMgr = new CommandMgr(); _buffMgr = new BuffMgr(this); //// Load Mecha Data //UnityFactory.factory.LoadDragonBonesData("DB/hero/hr021_ske"); //UnityFactory.factory.LoadTextureAtlasData("DB/hero/hr021_tex"); //// Build Mecha Armature //ArmatureComp = UnityFactory.factory.BuildArmatureComponent("Hero"); //// //ArmatureComp.CloseCombineMeshs(); //ArmatureComp.sortingOrder = 100; //ArmatureComp.sortingLayerName = "Active"; //ArmatureComp.transform.parent = transform; //ArmatureComp.transform.position = Vector3.zero; _bornPosition = transform.position; InitArmature(); _roleInfo.addListener(EventBase.CHANGE, OnInfoChanged); }
public void OnAccept(IAsyncResult ar) { TcpListener listener = (TcpListener)ar.AsyncState; if (listener.Server != null && listener.Server.IsBound) { //Listener can BeginAccept the next connection immediately after this... TcpClient tcpc = listener.EndAcceptTcpClient(ar); //...trigger manual reset event Program.connectionAccepted.Set(); //Log IPEndPoint remoteEP = (IPEndPoint)tcpc.Client.RemoteEndPoint; m_Logger.Record(String.Format("Connection accepted [{0}:{1}]; Awaiting authentication", remoteEP.Address, remoteEP.Port)); /* Identify client * * TODO: Eventually this will be an actual secure authentication process(TLS?). * For now, just get an identification token from the connecting client. */ Component componentType = Component.Error; try { byte[] rawIdentityToken = new byte[IDENTITY_TOKEN_LENGTH]; //Expect a 3-byte identity token. In any other case, drop the connection. tcpc.Client.ReceiveTimeout = 500; if (tcpc.Client.Receive(rawIdentityToken, IDENTITY_TOKEN_LENGTH, SocketFlags.None) != IDENTITY_TOKEN_LENGTH) { throw new KeyNotFoundException(); } componentType = new Dictionary <string, Component>() { { "HST", Component.MessageHost }, { "PUB", Component.Publisher }, { "SUB", Component.Subscriber } }[Encoding.UTF8.GetString(rawIdentityToken)]; } catch (KeyNotFoundException) { //Drop the connection if (tcpc.Connected) { tcpc.Close(); } m_Logger.Record(String.Format("Authentication FAIL [{0}:{1}]; Dropping connection", remoteEP.Address, remoteEP.Port)); } finally { tcpc.Client.ReceiveTimeout = 0; } //Client has been identified. Handle case for each component type. BuffMgr buffer = new BuffMgr(); switch (componentType) { case Component.MessageHost: //Add new MessageHost client info to collection lock (listRxBuffersLock) { m_RxBuffers.Add(remoteEP, buffer); } lock (listMessageHostsLock) { m_MessageHosts.Add(tcpc); UpdateConsole_ClientLog(); } //Set to receive from MessageHost tcpc.Client.BeginReceive(buffer.rawBytes, 0, buffer.rawBytes.Length, SocketFlags.None, new AsyncCallback(OnMessageHostReceive), tcpc.Client); m_Logger.Record(String.Format("Authentication SUCCESS; Ready to receive from MessageHost[{0}:{1}]", remoteEP.Address, remoteEP.Port)); break; case Component.Publisher: //Expect to receive the Publisher's GUID m_Logger.Record(String.Format("Authentication SUCCESS; Ready to receive GUID from Publisher[{0}:{1}]", remoteEP.Address, remoteEP.Port)); byte[] rawPubGuid = new byte[GUID_LENGTH]; if (tcpc.Client.Receive(rawPubGuid, GUID_LENGTH, SocketFlags.None) != GUID_LENGTH) { //Error occurred, drop the connection if (tcpc.Connected) { tcpc.Close(); } m_Logger.Record(String.Format("Invalid GUID received from Publisher[{0}:{1}]; Dropping connection", remoteEP.Address, remoteEP.Port)); } else { //Validate GUID Guid pubGuid; try { pubGuid = new Guid(rawPubGuid); } catch { //Invalid GUID, drop the connection if (tcpc.Connected) { tcpc.Close(); } m_Logger.Record(String.Format("Invalid GUID received from Publisher[{0}:{1}]; Dropping connection", remoteEP.Address, remoteEP.Port)); break; } //Determine which MessageHost is least busy, exchange session info between the two endpoints IPEndPoint hostEP = null; lock (listMessageHostsLock) { //TODO... //if (m_MessageHosts.Count > 0) // hostEP = (IPEndPoint)m_MessageHosts.SortBy(mh => mh.NumberServed?)[0].Socket.RemoteEndPoint; } //TODO... //if (TransferConnection(hostEP, remoteEP)) //{ //Record the publisher's GUID, and MessageHost endpoint lock (listPubServersLock) { m_PubServers.Add(pubGuid, hostEP); } //} m_Logger.Record(String.Format("MessageHost[{0}:{1}] will serve Publisher[{2}:{3}]; Transferring connection", hostEP.Address, hostEP.Port, remoteEP.Address, remoteEP.Port)); } break; case Component.Subscriber: //Expect to receive target Publisher's GUID from Subscriber m_Logger.Record(String.Format("Authentication SUCCESS; Ready to receive target GUID from Subscriber[{0}:{1}]", remoteEP.Address, remoteEP.Port)); byte[] rawTargetGuid = new byte[GUID_LENGTH]; if (tcpc.Client.Receive(rawTargetGuid, GUID_LENGTH, SocketFlags.None) != GUID_LENGTH) { //Error occurred, drop the connection if (tcpc.Connected) { tcpc.Close(); } m_Logger.Record(String.Format("Invalid GUID received from Publisher[{0}:{1}]; Dropping connection", remoteEP.Address, remoteEP.Port)); break; } else { //Validate GUID Guid targetGuid; try { targetGuid = new Guid(rawTargetGuid); } catch { //Invalid GUID, drop the connection if (tcpc.Connected) { tcpc.Close(); } m_Logger.Record(String.Format("Invalid GUID received from Subscriber[{0}:{1}]; Dropping connection", remoteEP.Address, remoteEP.Port)); break; } //Determine which MessageHost is serving the target publisher, exchange session info IPEndPoint hostEP = null; lock (listPubServersLock) { hostEP = (IPEndPoint)m_PubServers[targetGuid]; } //TODO... //if (TransferConnection(hostEP, remoteEP)) //{ // m_Logger.Record(String.Format("MessageHost[{0}:{1}] will serve Publisher[{2}:{3}]; Transferring connection", hostEP.Address, hostEP.Port, remoteEP.Address, remoteEP.Port)); //else // m_Logger.Record(String.Format("MessageHost[{0}:{1}] will serve Publisher[{2}:{3}]; Transferring connection", hostEP.Address, hostEP.Port, remoteEP.Address, remoteEP.Port)); //} } break; default: break; } } }
public void GetData(int id, bool isEnemy) { List <FightUnit> unitList = FightLogic.Instance.AllFighters; if (unitList.Count == 0) { return; } if (AllFighter.Count == 0) { return; } for (int i = 0; i < unitList.Count; i++) { if (unitList[i].UID == id || id == 0) { if (isEnemy == unitList[i].IsEnemy) { if (id == 0) { AllFighter[i].fighter_tog.isOn = true; fighter = unitList[i]; break; } else { fighter = unitList[i]; } } } } if (fighter == null) { return; } BuffMgr buff = fighter.BuffMgrObj; //所加状态 #region if (objName.Count > buff._allBuff.Count) { for (int i = 0; i < objName.Count; i++) { if (i >= buff._allBuff.Count) { objName[i].gameObject.SetActive(false); } else { objName[i].gameObject.SetActive(true); string objDesc = buff._allBuff[i].Desc; objName[i].text = buff._allBuff[i].BuffId.ToString() + ":" + objDesc; } } } else { for (int i = 0; i < buff._allBuff.Count; i++) { string objDesc = buff._allBuff[i].Desc; if (i == objName.Count) { Text o = BuffText().GetComponent <Text>(); o.text = buff._allBuff[i].BuffId.ToString() + ":" + objDesc; objName.Add(o); } else { objName[i].gameObject.SetActive(true); objName[i].text = buff._allBuff[i].BuffId.ToString() + ":" + objDesc; } } } #endregion //buff数据 #region MaxHealth_txt.text = fighter.BaseMaxHp.ToString(); StealHealth_txt.text = (fighter.HPSuck).ToString(); CurHealth_txt.text = fighter.CurHP.ToString(); VigourStimulate_txt.text = fighter.VigourSuck.ToString(); HealthRegen_txt.text = string.Format("{0:P2}", fighter.HPRec); VigourRegen_txt.text = fighter.VigourRec.ToString(); AttackSpeed_txt.text = fighter.Asp.ToString(); PhysicalAttacks_txt.text = fighter.Atk.ToString(); StrategicAttack_txt.text = fighter.Matk.ToString("f2"); Damage_txt.text = (fighter.HarmRate).ToString(); Treatment_txt.text = (fighter.HealRate).ToString(); PhysicalRes_txt.text = string.Format("{0:P2}", fighter.DefRate); StrategicRes_txt.text = string.Format("{0:P2}", fighter.MdefRate); AlienationRes_txt.text = (fighter.DeBetrayRate).ToString(); DizzinessRes_txt.text = (fighter.DeFaintRate).ToString(); MisrepresentingRes_txt.text = (fighter.DeSpoofRate).ToString(); PhysicalPenetration_txt.text = string.Format("{0:P2}", fighter.DefBreak); StrategicPenetration_txt.text = string.Format("{0:P2}", fighter.MdefBreak); AlienationRate_txt.text = fighter.BetrayRate.ToString(); DizzinessRate_txt.text = fighter.FaintRate.ToString(); DodgeRate_txt.text = string.Format("{0:P2}", fighter.DodgeRate); MisrepresentingRate_txt.text = fighter.SpoofRate.ToString(); HitRate_txt.text = string.Format("{0:P2}", fighter.HitRate); BlockRate_txt.text = string.Format("{0:P2}", fighter.BlockRate); RoutRate_txt.text = string.Format("{0:P2}", fighter.RoutRate); FirmRate_txt.text = string.Format("{0:P2}", fighter.FirmRate); CritRate_txt.text = string.Format("{0:P2}", fighter.CritRate); CritInc_txt.text = string.Format("{0:P2}", fighter.CritInc); #endregion }
public FireAtkX(Player player, BuffMgr buffMgr, float duration, int buffId, float val) { Init(player, buffMgr, duration, buffId, val); }
public FireCountTimesXBuff(Player player, BuffMgr buffMgr, float duration, int buffId, float val) { Init(player, buffMgr, duration, buffId, val); }
public void InitMgrs() { mSkillMgr = gameObject.AddComponent <SkillMgr>(); mBuffMgr = gameObject.AddComponent <BuffMgr>(); }