public void SetSkillCD(int skillID, float cd) { SkillCDData tmpData = null; for (int i = 0, max = mSkillCDs.Count; i < max; ++i) { if (mSkillCDs[i].SkillID == skillID) { tmpData = mSkillCDs[i]; break; } } if (null == tmpData) { tmpData = new SkillCDData(); tmpData.SkillID = skillID; mSkillCDs.Add(tmpData); } tmpData.CD = cd; var tmpEvent = ReferencePool.Fetch <PlayerCtrlEvent.UpdateSkillCD>(); tmpEvent.SkillID = skillID; tmpEvent.CD = cd; Game.EventMgr.FireNow(this, tmpEvent); }
public virtual void AddDp(int v) { if (Dead) { return; } int tmpMaxDp = mUnitAttr.Get(EPA.MaxDP); int tmpCurrDp = Mathf.Clamp(mUnitAttr.Get(EPA.CurDP) + v, 0, tmpMaxDp); mUnitAttr.Set(EPA.CurDP, tmpCurrDp); if (tmpCurrDp <= 0) { SetIsPabodyState(false); } else if (tmpCurrDp >= tmpMaxDp) { SetIsPabodyState(true); } var tmpEvent = ReferencePool.Fetch <UnitEvent.DpModify>(); tmpEvent.Data = this; Game.EventMgr.FireNow(this, tmpEvent); }
private void OnStartBtnClick(PointerEventData arg) { PVEGameBuilder.Instance.InstanceID = mInstanceID; var tmpEvent = ReferencePool.Fetch <InstanceWndEvent.StartInstanceEvent>(); Game.EventMgr.FireNow(this, tmpEvent); }
public void InitUI(GameObject skillGo) { mIconImg = Utility.GameObj.Find <Image>(skillGo, "Image_Icon"); mCDImg = Utility.GameObj.Find <Image>(skillGo, "Image_CD"); UGUIEventListener.Get(skillGo).onDown = OnSkillDown; UGUIEventListener.Get(skillGo).onUp = OnSkillUp; mIconLoader = ReferencePool.Fetch <ImageLoader>(); }
protected override void OnDead() { base.OnDead(); var tmpEvent = ReferencePool.Fetch <UnitEvent.Dead>(); tmpEvent.Data = this; Game.EventMgr.FireNow(this, tmpEvent); }
protected override void AfterInit() { base.AfterInit(); mLT = Find("LT"); mRoleInfo = Find(mLT, "RoleInfo"); mRoleNameLab = Find <Text>(mRoleInfo, "Text_Name"); mRoleIconImg = Find <Image>(mRoleInfo, "Image_Icon"); mRoleIconLoader = ReferencePool.Fetch <ImageLoader>(); mRoleHpImg = Find <Image>(mRoleInfo, "Image_Hp"); mRoleMpImg = Find <Image>(mRoleInfo, "Image_Mp"); mRoleDpImg = Find <Image>(mRoleInfo, "Image_Dp"); mRT = Find("RT"); mEnemyInfo = Find(mRT, "EnemyInfo"); mEnemyIconImg = Find <Image>(mEnemyInfo, "Image_Icon"); mEnemyIconLoader = ReferencePool.Fetch <ImageLoader>(); mEnemyHpImg = Find <Image>(mEnemyInfo, "Image_Hp"); mEnemyDpImg = Find <Image>(mEnemyInfo, "Image_Dp"); mCombo = new UICombo(Find(mRT, "Combo")); mLB = Find("LB"); var tmpJoystickGo = Find(mLB, "UGUIJoystick"); mJoystick = new UGUIJoystick(); mJoystick.Init(tmpJoystickGo, Find <Image>(tmpJoystickGo, "Background"), Find <Image>(tmpJoystickGo, "Center")); mRB = Find("RB"); mSkillInfo = Find(mRB, "SkillInfo"); for (int i = 0, max = SKILL_NUM; i < max; ++i) { GameObject tmpSkillGo = Find(mSkillInfo, $"Button_Skill{i}"); SkillInput tmpSkillInput = new SkillInput(); tmpSkillInput.InitUI(tmpSkillGo); mSkillInputs[i] = tmpSkillInput; } GameObject tmpAtkGo = Find(mSkillInfo, "Button_Atk"); RegisterEventClickDown(tmpAtkGo, OnAtkBtnDown); RegisterEventClickUp(tmpAtkGo, OnAtkBtnUp); RegisterEventDoubleClick(tmpAtkGo, OnAtkBtDoubleClick); GameObject tmpJumpGo = Find(mSkillInfo, "Button_Jump"); RegisterEventClickDown(tmpJumpGo, OnJumpBtnDown); RegisterEventDoubleClick(tmpJumpGo, OnJumpBtnDoubleClick); GameObject tmpSkillExGo = Find(mSkillInfo, "Button_SkilEx"); mExSkillInput = new SkillInput(); mExSkillInput.InitUI(tmpSkillExGo); //RegisterEventClickDown(tmpSkillExGo, OnDefenseBtnDown); //RegisterEventClickUp(tmpSkillExGo, OnDefenseBtnUp); RegisterEventClick(Find(mRT, "Button_SkillSystem"), OnSkillModuleBtnClick); }
public void Reset() { mIsRunning = false; mCamera.orthographicSize = mOrthographicSize; var tmpEventArg = ReferencePool.Fetch <CameraActionEvent.ModifySceneMaskColor>(); tmpEventArg.Data = Color.clear; Game.EventMgr.FireNow(this, tmpEventArg); }
public override ECombatResult Combat(IActUnit target, ISkillItem skillItem) { ECombatResult tmpResult = base.Combat(target, skillItem); if (ECombatResult.ECR_Block != tmpResult) { Game.EventMgr.FireNow(this, ReferencePool.Fetch <UnitEvent.Combo>()); } return(tmpResult); }
public void SetHitedMonster(Monster monster) { if (CurrHitedMonster != monster || monster.Dead) { this.CurrHitedMonster = monster.Dead ? null : monster; var tmpEvent = ReferencePool.Fetch <UnitCtrlEvent.CurrHitedMonsterChange>(); tmpEvent.Data = CurrHitedMonster; Game.EventMgr.FireNow(this, tmpEvent); } }
private void OnBackBtnClick(PointerEventData arg) { var tmpCtrl = Game.ControllerMgr.Get <PlayerController>(); tmpCtrl.SaveSkill(); if (tmpCtrl.CurrSkillPage != mSkillPage) { tmpCtrl.SetCurrSkillPage(mSkillPage); } Game.EventMgr.FireNow(this, ReferencePool.Fetch <SkillWndEvent.SkillSetChange>()); Close(); }
public K AddComponent <K>() where K : UnitComponentBase, new() { K tmpComponent = ReferencePool.Fetch <K>(); if (this.mComponentDict.ContainsKey(tmpComponent.GetType())) { throw new Exception($"AddComponent, component already exist, component: {typeof(K).Name}"); } tmpComponent.SetParent(this); mComponentList.Add(tmpComponent); mComponentDict.Add(tmpComponent.GetType(), tmpComponent); if (tmpComponent is UnitComponentBase.IInit0) { (tmpComponent as UnitComponentBase.IInit0).Init(); } return(tmpComponent); }
public void Refresh(SkillBase data) { SkillBase = data; if (null == data) { return; } if (null == IconLoader) { IconLoader = ReferencePool.Fetch <ImageLoader>(); } IconLoader.Load(ImageLoader.EIconType.Skill, data.Icon, IconImg); if (null != SkillName) { SkillName.text = data.Name; } }
public virtual void AddHp(int v) { if (Dead) { return; } int tmpCurrHp = Mathf.Clamp(mUnitAttr.Get(EPA.CurHP) + v, 0, mUnitAttr.Get(EPA.MaxHP)); mUnitAttr.Set(EPA.CurHP, tmpCurrHp); if (tmpCurrHp <= 0) { SetIsDead(true); } var tmpEvent = ReferencePool.Fetch <UnitEvent.HpModify>(); tmpEvent.Data = this; Game.EventMgr.FireNow(this, tmpEvent); }
private void Update_Lighteness(float deltaTime) { float tmpRatio = 0f; if (mRunningTime > mLightenessPreTime + mLightenessKeepTime + mLightenessOutTime) { return; } else if (mRunningTime > mLightenessPreTime + mLightenessKeepTime) { tmpRatio = mLightenessOutTime > 0f ? (mRunningTime - mLightenessPreTime - mLightenessKeepTime) / mLightenessOutTime : 1f; var tmpEventArg = ReferencePool.Fetch <CameraActionEvent.ModifySceneMaskColor>(); tmpEventArg.Data = mLightenessOffset * (1 - tmpRatio); Game.EventMgr.FireNow(this, tmpEventArg); } else if (mRunningTime <= mLightenessPreTime) { tmpRatio = mLightenessPreTime > 0f ? mRunningTime / mLightenessPreTime : 1f; var tmpEventArg = ReferencePool.Fetch <CameraActionEvent.ModifySceneMaskColor>(); tmpEventArg.Data = mLightenessOffset * tmpRatio; Game.EventMgr.FireNow(this, tmpEventArg); } }
private void OnBackBtnClick(PointerEventData arg) { Game.EventMgr.FireNow(this, ReferencePool.Fetch <PVESettleWndEvent.BackMainEvent>()); }