private void InitUI() { GameLogic.Hold.Sound.PlayUI(0xf4244); this.buttonok.onClick = new Action(this.OnClickOK); this.buttoncancel.onClick = new Action(this.OnClickCanccel); GameLogic.SetPause(true); bool flag = GameLogic.Random(0, 100) < 40; Room_eventdemontext2lose _eventdemontextlose = null; int randomID = GameLogic.Release.Form.GetRandomID("DemonSkill"); this.mFormid = randomID; Room_eventdemontext2skill beanById = LocalModelManager.Instance.Room_eventdemontext2skill.GetBeanById(randomID); int index = GameLogic.Random(0, beanById.Loses.Length); int num4 = beanById.Loses[index]; _eventdemontextlose = LocalModelManager.Instance.Room_eventdemontext2lose.GetBeanById(beanById.Loses[index]); this.mGetid = beanById.GetID; object[] args = new object[] { GameLogic.Hold.Language.GetLanguageByTID("获得技能", Array.Empty <object>()), GameLogic.Hold.Language.GetSkillName(this.mGetid) }; this.text_content2.text = Utils.FormatString("{0} : {1}", args); int skillIcon = LocalModelManager.Instance.Skill_skill.GetBeanById(this.mGetid).SkillIcon; this.image_2.set_sprite(SpriteManager.GetSkillIcon(skillIcon)); this.image_2.GetComponent <RectTransform>().sizeDelta = new Vector2(120f, 120f); this.mLoseid = _eventdemontextlose.LoseID; Goods_goods.GoodData goodData = Goods_goods.GetGoodData(LocalModelManager.Instance.Goods_food.GetBeanById(this.mLoseid).Values[0]); string str = MathDxx.Abs((long)(((float)(GameLogic.Self.m_EntityData.attribute.HPValue.ValueLong * goodData.value)) / 10000f)).ToString(); object[] objArray2 = new object[] { GameLogic.Hold.Language.GetLanguageByTID("失去", Array.Empty <object>()), str, GameLogic.Hold.Language.GetLanguageByTID(_eventdemontextlose.Content1, Array.Empty <object>()) }; this.text_content1.text = Utils.FormatString("{0} {1} {2}", objArray2); }
public List <Goods_goods.GoodShowData> GetEquipShowAttrs(LocalSave.EquipOne one) { List <Goods_goods.GoodShowData> list = new List <Goods_goods.GoodShowData>(); int level = one.Level; Equip_equip beanById = base.GetBeanById(one.EquipID); int index = 0; int length = beanById.Attributes.Length; while (index < length) { Goods_goods.GoodData goodData = Goods_goods.GetGoodData(beanById.Attributes[index]); level = MathDxx.Clamp(level, 0, one.CurrentMaxLevel); if (goodData.percent) { goodData.value += ((level - 1) * beanById.AttributesUp[index]) * 100; } else { goodData.value += (level - 1) * beanById.AttributesUp[index]; } goodData.value = (long)(goodData.value * (1f + GameLogic.SelfAttributeShow.GetUpPercent(one.Position))); Goods_goods.GoodShowData goodShowData = Goods_goods.GetGoodShowData(goodData); if (one.IsBaby && !goodData.goodType.Contains("EquipBaby:")) { string languageByTID = GameLogic.Hold.Language.GetLanguageByTID("Attr_BabyParentContent", Array.Empty <object>()); object[] args = new object[] { languageByTID, goodShowData.goodType }; goodShowData.goodType = Utils.FormatString("{0}{1}", args); } list.Add(goodShowData); index++; } return(list); }
private void UpdateMoveSpeed() { float num = (this.movetime * this.addspeed) + 1f; num = MathDxx.Clamp(num, num, this.maxspeed); this.m_MoveData._moveDirection = this.m_MoveData._moveDirection.normalized * num; }
private void OnAttack() { this.angle = base.m_Entity.eulerAngles.y + 90f; this.offsetpos = new Vector3(MathDxx.Sin(this.angle), 0f, MathDxx.Cos(this.angle)); this.CreateBullet(-1f); this.CreateBullet(1f); }
private void InitUI() { this.Text_ID.text = this.mTransfer.id; int num = 0x3e8; string receipt = this.mTransfer.receipt; int num2 = (this.mTransfer.receipt.Length / num) + 1; float y = 0f; for (int i = 0; i < num2; i++) { int startIndex = i * num; int num6 = (i + 1) * num; num6 = MathDxx.Clamp(num6, 0, this.mTransfer.receipt.Length); if (num6 < startIndex) { startIndex = num6; } string str2 = "empty"; if (startIndex < num6) { str2 = receipt.Substring(startIndex, num6 - startIndex); } Text text = this.mPool.DeQueue <Text>(); text.transform.SetParentNormal(this.mScrollRect.get_content()); text.text = str2; (text.transform as RectTransform).anchoredPosition = new Vector2(0f, -y); y += text.preferredHeight; if (startIndex == num6) { break; } } this.mScrollRect.get_content().sizeDelta = new Vector2(this.mScrollRect.get_content().sizeDelta.x, y); this.Text_Title.text = "读取消息流失败"; }
protected override void OnInit() { this.movex = MathDxx.Sin(base.transform.eulerAngles.y); this.movey = MathDxx.Cos(base.transform.eulerAngles.y); this.move = new Vector3(this.movex, 0f, this.movey); this.currentdis = 0f; }
protected override void UpdateProcess() { base.UpdateProcess(); this.mBoxTime += Updater.delta; this.mBoxTime = MathDxx.Clamp01(this.mBoxTime); this.UpdateBox(); }
protected override void OnUpdate() { if (this.starttime == 0f) { if (base.m_Entity.m_AttackCtrl.RotateOver()) { this.starttime = Updater.AliveTime + 0.5f; this.startattacktime = this.starttime + 0.2f; } } else if ((this.starttime > 0f) && (Updater.AliveTime >= this.starttime)) { if (!this.bStartAttack && (Updater.AliveTime >= this.startattacktime)) { this.bStartAttack = true; this.Attack(); } this.moveby += (Updater.delta / this.movetime) * this.alldis; if (this.moveby >= this.perdis) { this.moveby -= this.perdis; this.AttackGround(); } this.percentby = ((Updater.AliveTime - this.starttime) / this.movetime) - this.percent; this.percent = (Updater.AliveTime - this.starttime) / this.movetime; this.percent = MathDxx.Clamp01(this.percent); base.m_Entity.SetPositionBy((this.endpos - this.startpos) * this.percentby); if (this.percent == 1f) { this.starttime = -1f; } } }
protected override void OnInitBase() { if (base.m_Entity.m_HatredTarget == null) { base.End(); } else { base.m_Entity.mAniCtrlBase.UpdateAnimationSpeed("Skill", -0.5f); this.delaytime = Updater.AliveTime + 0.4f; this.starttime = Updater.AliveTime; this.halftime = this.alltime / 2f; this.startpos = base.m_Entity.position; this.bAttack = false; base.m_Entity.m_AniCtrl.SendEvent("Skill", false); this.endx = base.m_Entity.m_HatredTarget.position.x; this.endz = base.m_Entity.m_HatredTarget.position.z; bool flag = MathDxx.RandomBool(); this.perendx = (this.endx - base.m_Entity.position.x) / ((float)this.flyframe); this.perendz = (this.endz - base.m_Entity.position.z) / ((float)this.flyframe); base.m_Entity.SetObstacleCollider(false); this.dir = new Vector3(this.perendx, 0f, this.perendz); this.UpdateDirection(); } }
private void OnUpdate() { if ((Time.time - this.checkTime) > 3.1f) { this.checkTime = Time.time; this.iter = this.mEffectList.GetEnumerator(); while (this.iter.MoveNext()) { this.iterkey = this.iter.Current.Key; this.itertime = this.GetLastUseTime(this.iterkey); if (!this.mEffectCounts.TryGetValue(this.iterkey, out this.stCountTemp)) { this.stCountTemp = this.stCount; } if (this.mEffectList.TryGetValue(this.iterkey, out this.iterq) && ((Time.time - this.itertime) > 190f)) { this.RemoveMoreEffects(this.iterq, this.stCountTemp); if ((Time.time - this.itertime) > 200f) { this.itertimecount = (int)((((Time.time - this.itertime) - 190f) - 10f) / 10f); this.itertimecount = this.stCountTemp - this.itertimecount; this.itertimecount = MathDxx.Clamp(this.itertimecount, 0, this.itertimecount); this.RemoveMoreEffects(this.iterq, this.itertimecount); } } } } }
private void CreateBulletByAngle(float angle) { float x = MathDxx.Sin(angle); float z = MathDxx.Cos(angle); base.CreateBulletOverride(new Vector3(x, 0f, z), angle); }
private void OnUpdate() { if ((Time.time - this.checkTime) > 3f) { this.checkTime = Time.time; this.iter = this.mBulletList.GetEnumerator(); while (this.iter.MoveNext()) { this.iterkey = this.iter.Current.Key; if (!this.mBulletCounts.TryGetValue(this.iterkey, out this.stCountTemp)) { this.stCountTemp = this.stCount; } this.itertime = this.GetLastUseTime(this.iterkey); this.iterq = this.iter.Current.Value; if ((this.iterq != null) && ((Time.time - this.itertime) > 180f)) { this.RemoveMoreBullets(this.iterq, this.stCountTemp); if ((Time.time - this.itertime) > 540f) { this.itertimecount = (int)(((Time.time - this.itertime) - 540f) / 180f); this.itertimecount = this.stCountTemp - this.itertimecount; this.itertimecount = MathDxx.Clamp(this.itertimecount, 0, this.itertimecount); this.RemoveMoreBullets(this.iterq, this.itertimecount); } } } } }
private void InitUI() { string str = string.Empty; DateTime time = new DateTime(this.mTransfer.assertendtime); DateTime now = DateTime.Now; TimeSpan span = (TimeSpan)(time - now); if (span.Days >= 1) { object[] objArray1 = new object[] { span.Days }; str = GameLogic.Hold.Language.GetLanguageByTID("time_day", objArray1); } else if (span.Hours >= 1) { object[] objArray2 = new object[] { span.Hours }; str = GameLogic.Hold.Language.GetLanguageByTID("time_hour", objArray2); } else { int num = MathDxx.Clamp(span.Minutes, 10, span.Minutes); object[] objArray3 = new object[] { num }; str = GameLogic.Hold.Language.GetLanguageByTID("time_hour", objArray3); } object[] args = new object[] { str }; string languageByTID = GameLogic.Hold.Language.GetLanguageByTID("serverassert_content", args); this.Text_Content.text = languageByTID; }
public BulletTransmit(EntityBase entity, int bulletid, bool clear = false) { this.m_Entity = entity; this.weapondata = LocalModelManager.Instance.Weapon_weapon.GetBeanById(bulletid); this.mThunderRatio = 1f; this.attackratio = 1f; if (this.m_Entity == null) { this.attribute = new EntityAttributeBase(); } else { if (!clear) { this.attribute = new EntityAttributeBase(this.m_Entity.m_Data.CharID); this.m_Entity.m_EntityData.attribute.AttributeTo(this.attribute); this.CritRate = this.attribute.CritRate.Value; this.CritSuperRate = this.attribute.CritSuperRate.Value; this.mThroughEnemy = this.m_Entity.m_EntityData.ThroughEnemy; this.mThroughRatio = this.m_Entity.m_EntityData.ThroughRatio; this.mDebuffList = this.m_Entity.GetDebuffList(); this.mHitCreate2 = this.m_Entity.m_EntityData.HitCreate2; this.mHitCreate2Percent = this.m_Entity.m_EntityData.mHitCreate2Percent; this.mHitSputter = this.m_Entity.m_EntityData.BulletSputter; this.trailType = this.m_Entity.m_EntityData.ArrowTrailType; this.headType = this.m_Entity.m_EntityData.ArrowHeadType; } else { this.Clear(); } this.attack = MathDxx.CeilToInt((float)this.m_Entity.m_EntityData.GetAttack(this.weapondata.Attack)); } }
private void Update_Runnings() { if (CameraFollow) { base.transform.position = GameLogic.Self.position; } else { float num = MathDxx.Abs((float)(base.transform.position.z - GameLogic.Self.position.z)); if (num < 0.2f) { base.transform.position = GameLogic.Self.position; } else { float t = (this.speed * Updater.delta) / num; if (t > 1f) { t = 1f; } float z = ((GameLogic.Self.position.z - base.transform.position.z) * t) + base.transform.position.z; base.transform.position = new Vector3(0f, 0f, z); base.transform.position = Vector3.Lerp(base.transform.position, GameLogic.Self.position, t); } this.SetCameraRound(); } }
private void JumpAction() { base.AddAction(base.GetActionWait(string.Empty, 200)); base.AddAction(base.GetActionDelegate(delegate { base.m_Entity.m_AniCtrl.SetString("Skill", "Jump"); base.m_Entity.mAniCtrlBase.UpdateAnimationSpeed("Skill", 1f); base.m_Entity.m_AniCtrl.SendEvent("Skill", false); })); base.AddAction(base.GetActionWait(string.Empty, 400)); base.AddAction(base.GetActionDelegate(delegate { Vector3 position = base.m_Entity.position; for (int i = 0; i < 4; i++) { float num = i * 90f; for (int j = 0; j < 3; j++) { float angle = num + GameLogic.Random((float)0f, (float)90f); float x = MathDxx.Sin(angle); float z = MathDxx.Cos(angle); GameLogic.Release.Bullet.CreateBullet(base.m_Entity, 0x13aa, position + new Vector3(x, 0.5f, z), angle); } } })); base.AddAction(base.GetActionDelegate(() => base.m_Entity.mAniCtrlBase.UpdateAnimationSpeed("Skill", -1f))); }
private void Update() { this.time += Time.deltaTime; if (this.state == 0) { float num = MathDxx.Clamp(this.time, 0f, 0.3f) / 0.3f; this.child.transform.localScale = Vector3.one * num; if (this.time > this.downtime) { this.state = 1; } } else if (this.state == 1) { if (this.time > this.alltime) { this.time = this.alltime; } float num2 = (this.time - this.downtime) / (this.alltime - this.downtime); this.child.transform.localPosition = new Vector3(0f, 0f, 15f * (1f - num2)); if (this.time >= this.alltime) { this.child.SetActive(false); } } }
public void CheckBulletLength() { float x = MathDxx.Sin(base.bulletAngle); float z = MathDxx.Cos(base.bulletAngle); Vector3 direction = new Vector3(x, 0f, z); RaycastHit[] hitArray = Physics.RaycastAll(base.mTransform.position, direction, 100f, this.layerMask); float distance = 100f; int index = 0; int length = hitArray.Length; while (index < length) { RaycastHit hit = hitArray[index]; if ((((hit.collider.gameObject.layer == LayerManager.Stone) && !base.m_Data.bThroughWall) || (hit.collider.gameObject.layer == LayerManager.MapOutWall)) && (distance > hit.distance)) { distance = hit.distance; } index++; } float num6 = distance / 13f; if (this.effect != null) { this.effect.localScale = new Vector3(num6, 1f, 1f); } this.effectctrl.SetScale(num6); base.boxList[0].center = new Vector3(0f, 0f, distance / 2f); base.boxList[0].size = new Vector3(base.boxList[0].size.x, base.boxList[0].size.y, distance); this.effect.gameObject.SetActive(true); }
protected override void OnInitBase() { this.delaytime = Updater.AliveTime + 0.15f; this.starttime = Updater.AliveTime; this.halftime = this.alltime / 2f; this.startpos = base.m_Entity.position; this.bAttack = false; bool dir = MathDxx.RandomBool(); if (!GameLogic.Release.MapCreatorCtrl.RandomItemLine(base.m_Entity, dir, this.rangemin, this.rangemax, out this.endx, out this.endz)) { dir = !dir; if (!GameLogic.Release.MapCreatorCtrl.RandomItemLine(base.m_Entity, dir, this.rangemin, this.rangemax, out this.endx, out this.endz)) { base.End(); return; } } this.perendx = (this.endx - base.m_Entity.position.x) / ((float)this.flyframe); this.perendz = (this.endz - base.m_Entity.position.z) / ((float)this.flyframe); base.m_Entity.SetObstacleCollider(false); base.m_Entity.m_AniCtrl.SendEvent("Skill", false); this.dir = new Vector3(this.perendx, 0f, this.perendz); this.UpdateDirection(); }
protected override void OnAttack(object[] args) { if (base.m_Entity.IsElite) { if (MathDxx.RandomBool()) { int num = 4; for (int i = 0; i < num; i++) { base.action.AddActionDelegate(() => base.CreateBulletOverride(Vector3.zero, 0f)); base.action.AddActionWait(0.18f); } } else { for (int i = 0; i < 4; i++) { base.CreateBulletOverride(Vector3.zero, (i * 90f) + 45f); } } } else { base.OnAttack(args); } }
protected override void OnInitBase() { base.m_Entity.SetSuperArmor(true); this.isStart = false; if (base.m_Entity.m_HatredTarget == null) { base.m_Entity.m_HatredTarget = GameLogic.Self; } Vector2 vector2 = new Vector2(base.m_Entity.m_HatredTarget.position.x - base.m_Entity.position.x, base.m_Entity.m_HatredTarget.position.z - base.m_Entity.position.z); Vector2 normalized = vector2.normalized; if (GameLogic.Random((float)0f, (float)1f) > this.move2playertatio) { float angle = GameLogic.Random((float)0f, (float)360f); normalized.x = MathDxx.Sin(angle); normalized.y = MathDxx.Cos(angle); } this.Move_NextX = normalized.x; this.Move_NextY = normalized.y; if (normalized == Vector2.zero) { Vector2 vector8 = new Vector2(GameLogic.Random((float)-1f, (float)1f), GameLogic.Random((float)-1f, (float)1f)); Vector2 vector7 = vector8.normalized; this.Move_NextX = vector7.x; this.Move_NextY = vector7.y; } this.Move_NextTime = Updater.AliveTime; }
private void CreateLine(EntityBase entity) { EntityBase parent; if (this.line == null) { this.line = GameLogic.EffectGet("Effect/Attributes/LifeLine"); this.line.transform.SetParent(GameNode.m_PoolParent.transform); this.mLineCtrl = this.line.GetComponent <LifeLineCtrl>(); this.mLineCtrl.mCacheEvent = new Action(this.CacheEvent); } this.mLineCtrl.UpdateEntity(base.m_Entity, entity); this.hit = MathDxx.CeilToInt(this.attackratio * base.m_Entity.m_EntityData.attribute.AttackValue.ValueCount); entity.m_EntityData.ExcuteBuffs(base.m_Entity, base.BuffID, base.buff_data.Attribute, (float)-this.hit); if (this.m_EntityBaby != null) { parent = this.m_EntityBaby.GetParent(); } else { parent = base.m_Entity; } this.hprecover = MathDxx.CeilToInt(this.hprecoverratio * parent.m_EntityData.attribute.GetHPBase()); parent.m_EntityData.ExcuteBuffs(base.m_Entity, base.BuffID, base.buff_data.Attribute, (float)this.hprecover); }
private void UpdateDirection() { float x = this.target.position.x - base.m_Entity.position.x; float y = this.target.position.z - base.m_Entity.position.z; float num3 = Utils.getAngle(x, y); if (this.state == 0) { this.offsetangle += this.peradd; if (MathDxx.Abs(this.offsetangle) >= this.maxadd) { this.state = 1; } } else { this.offsetangle -= this.peradd; if (MathDxx.Abs(this.offsetangle) >= this.maxadd) { this.state = 0; } } this.m_MoveData.angle = num3 + this.offsetangle; this.m_MoveData.direction = new Vector3(MathDxx.Sin(this.m_MoveData.angle), 0f, MathDxx.Cos(this.m_MoveData.angle)); base.m_Entity.m_AttackCtrl.RotateHero(this.m_MoveData.angle); }
private void onClickButtonInternal(int count) { bool flag = false; bool flag2 = false; if (LocalSave.Instance.GetDiamondBoxFreeCount(base.mBoxType) > 0) { flag = true; flag2 = true; } else { count = MathDxx.Clamp(count, 0, base.mTransfer.diamonds.Length - 1); if (base.CheckCanOpen(2, this.get_price(count))) { flag2 = true; } } if (flag2) { if (LocalSave.Instance.GetTimeBoxCount(LocalSave.TimeBoxType.BoxChoose_DiamondNormal) > 0) { SdkManager.send_event_ad(ADSource.eDiamondNormal, "CLICK", 0, 0, string.Empty, string.Empty); } if (!NetManager.IsNetConnect) { CInstance <TipsUIManager> .Instance.Show(ETips.Tips_NetError, Array.Empty <string>()); if (LocalSave.Instance.GetTimeBoxCount(LocalSave.TimeBoxType.BoxChoose_DiamondNormal) > 0) { SdkManager.send_event_ad(ADSource.eDiamondNormal, "IMPRESSION", 0, 0, "FAIL", "NET_ERROR"); } } else if (LocalSave.Instance.GetTimeBoxCount(LocalSave.TimeBoxType.BoxChoose_DiamondNormal) > 0) { if (LocalSave.Instance.IsAdFree()) { this.send_get_box(); } else if (!AdsRequestHelper.getRewardedAdapter().isLoaded()) { SdkManager.send_event_ad(ADSource.eDiamondNormal, "IMPRESSION", 0, 0, "FAIL", "AD_NOT_READY"); WindowUI.ShowAdInsideUI(AdInsideProxy.EnterSource.eGameTurn, delegate { SdkManager.send_event_ad(ADSource.eDiamondNormal, "REWARD", 0, 0, "INSIDE", string.Empty); this.send_get_box(); }); } else { AdsRequestHelper.getRewardedAdapter().Show(this); SdkManager.send_event_ad(ADSource.eDiamondNormal, "IMPRESSION", 0, 0, "SUCCESS", string.Empty); } } else { this.send_get_box(); } } }
public HitStruct GetAttackStruct() { long num = MathDxx.CeilToInt(this.attack * this.attackratio); this.m_AttackStruct.before_hit = -num; this.m_AttackStruct.type = HitType.Normal; return(this.m_AttackStruct); }
public int nextInt(int min, int max) { if (min >= max) { return(min); } return((MathDxx.Abs(this.nextInt()) % (max - min)) + min); }
private void SetTrailScaleZ(float scalez) { if (this.trail != null) { scalez = MathDxx.Clamp01(scalez); this.trail.transform.localScale = new Vector3(1f, 1f, scalez); } }
private void RandomCloudY(ref float clouda, float cloudb) { clouda = GameLogic.Random(-this.randomheight, this.randomheight); while (MathDxx.Abs((float)(clouda - cloudb)) < 4f) { clouda = GameLogic.Random(-this.randomheight, this.randomheight); } }
protected virtual void OnGotoNextRoom(RoomGenerateBase.Room room) { float angle = GameLogic.Random((float)-80f, (float)80f); float x = MathDxx.Sin(angle); float z = MathDxx.Cos(angle); base.transform.position = base.m_Parent.position + (new Vector3(x, 0f, z) * GameLogic.Random((float)0f, (float)1f)); }
private void CreateBombOne() { Vector3 endpos = this.get_random_position(); BulletBombDodge dodge = GameLogic.Release.Bullet.CreateBullet(null, 0xbda, endpos + new Vector3(0f, 21f, 0f), 0f) as BulletBombDodge; dodge.SetEndPos(endpos); dodge.SetTarget(null, 1); dodge.mBulletTransmit.SetAttack((long)MathDxx.CeilToInt(0.35f * GameLogic.Self.m_EntityData.MaxHP)); }