public void Update(uint elapsed) { mLastMillionSec = (mLastMillionSec + elapsed) % uint.MaxValue; if ((mLastMillionSec - mOneSecNum) >= 1000) { mOneSecNum = mLastMillionSec; //Pdm.SubEggTimeSeconds( EggType et = EggType.Normal; for (int i = 0; i < 3; i++) { et = (EggType)(i + 1); int sec = GetSecondsByEggId(et); if (sec <= 0) { if (et == EggType.Normal) { CityFormManager.SetRedPointActive("egg", true); } continue; } Pdm.SubEggTimeSeconds(et); if (et == EggType.Normal) { CityFormManager.SetRedPointActive("egg", false); } } } }
public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData) { int data = Terrain.ExtractData(value); EggType eggType = GetEggType(data); BlocksManager.DrawMeshBlock(primitivesRenderer, eggType.BlockMesh, color, eggType.Scale * size, ref matrix, environmentData); }
void updateEggCostInfo() { PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>(); if (pdm == null) { return; } for (int i = 0; i < EggModule.EGG_COUNT; i++) { EggType et = (EggType)(i + 1); int num = EggModule.getCostProcNum(et); ProceedsType pt = EggModule.getCostProcType(et); if (pt == ProceedsType.Invalid || num <= 0) { costLb[i].transform.parent.gameObject.SetActive(false); } else { if (pdm.GetProceeds(pt) < num) { costLb[i].text = StringHelper.StringWithColor(FontColor.Red, num.ToString()); } else { costLb[i].text = num.ToString(); } UIAtlasHelper.SetSpriteByMoneyType(costSp[i], pt, false); costLb[i].transform.parent.gameObject.SetActive(true); } } }
/// <summary> /// /// </summary> /// <param name="eggIdx">范围[1..EggModule.EGG_COUNT]</param> /// <param name="times"></param> public bool AddEggOpenTimes(EggType et, int adder) { int idx = (int)et - 1; mEggData[idx].times += adder; return(true); }
public bool ResetEggTimeCounter(EggType et) { int idx = (int)et - 1; mEggData[idx].time_second = EggModule.getCountDownSeconds(et); return(true); }
public bool SubtractEggTimeCounter(EggType et, int subtractor) { int idx = (int)et - 1; mEggData[idx].time_second -= subtractor; return(true); }
/// <summary> /// 获得背包在每个蛋中的相对位置; /// </summary> /// <returns></returns> Vector3 getBagLocalPositionByEgg(EggType et) { Vector3 res = new Vector3(); res.x = bagBtn.transform.localPosition.x + bagBtn.transform.parent.localPosition.x - mEggs[(int)et - 1].transform.localPosition.x; res.y = bagBtn.transform.parent.localPosition.y - mEggs[(int)et - 1].transform.localPosition.y; res.z = 0f; return(res); }
public override float GetNutritionalValue(int value) { EggType eggType = GetEggType(Terrain.ExtractData(value)); if (!GetIsCooked(Terrain.ExtractData(value))) { return(eggType.NutritionalValue); } return(1.5f * eggType.NutritionalValue); }
void ShuffleEggTypes(ref EggType[] eggTypes) { for (int i = eggTypes.Length - 1; i > 0; i--) { int r = Random.Range(0, i); EggType tmp = eggTypes[i]; eggTypes[i] = eggTypes[r]; eggTypes[r] = tmp; } }
// 最大开蛋次数,知道次数重置; public static int getMaxOpenTimes(EggType et) { EggConfigTableItem item = DataManager.EggConfigTable[(int)et] as EggConfigTableItem; if (item == null) { GameDebug.LogError("表格数据错误"); return(-1); } return(item.times); }
// 开蛋时间间隔秒数; public static int getCountDownSeconds(EggType et) { EggConfigTableItem item = DataManager.EggConfigTable[(int)et] as EggConfigTableItem; if (item == null) { GameDebug.LogError("表格数据错误"); return(-1); } return(item.minutes * 60); }
public bool IsEnougthMoney(EggType et, ref ProceedsType pt) { pt = getCostProcType(et); if (Pdm.GetProceeds(pt) < getCostProcNum(et)) { return(false); } return(true); }
// 倒计时期间是否可以开蛋; public static bool canOpenInTimeCounting(EggType et) { EggConfigTableItem item = DataManager.EggConfigTable[(int)et] as EggConfigTableItem; if (item == null) { GameDebug.LogError("表格数据错误"); return(false); } return(item.canOpen != 0); }
public static ProceedsType getCostProcType(EggType et) { EggConfigTableItem item = DataManager.EggConfigTable[(int)et] as EggConfigTableItem; if (item == null) { GameDebug.LogError("表格数据错误"); return(ProceedsType.Invalid); } return((ProceedsType)item.procType); }
public static int getCostProcNum(EggType et) { EggConfigTableItem item = DataManager.EggConfigTable[(int)et] as EggConfigTableItem; if (item == null) { GameDebug.LogError("表格数据错误"); return(-1); } return(item.procNum); }
Vector3 getRandomEndPos(EggType et) { //Vector3 eggPos = mEggs[(int)et - 1].transform.localPosition; Vector3 res = new Vector3(); res.x = UnityEngine.Random.Range(-DropEndRange.x / 2f, DropEndRange.x / 2f); res.y = UnityEngine.Random.Range(-DropEndRange.y / 2f, DropEndRange.y / 2f); res.z = 0f; return(res + DropEndOffset); }
void playSucessEffect(EggType et) { int idx = (int)et; UISprite eggSpri = mEggs[idx - 1].GetComponent <UISprite>(); eggSpri.spriteName = EGG_NAMES[(idx - 1) * 2 + 1]; eggSpri.MakePixelPerfect(); ParticleAnimation ani = AnimationManager.Instance.PlayParticleAnimation(4, mEggs[idx - 1], 15); ani.gameObject.transform.localPosition = new Vector3(ani.gameObject.transform.localPosition.x, ani.gameObject.transform.localPosition.y + 100f, ani.gameObject.transform.localPosition.z); }
void createItems(EggType et, List <role_egg_item_items> items) { if (items == null || items.Count == 0) { return; } //GameObject go = new GameObject(); //go.transform.parent = mEggs[(int)et - 1].transform; //go.transform.localPosition = Vector3.zero; //go.transform.localScale = Vector3.one; int i = 0, j = items.Count; for (; i < j; i++) { GameObject go = createItem(et, items[i], mEggs[(int)et - 1]); if (go == null) { GameDebug.LogError("创建物品失败!"); continue; } Vector3 dropPos = getRandomEndPos(et); // 立刻执行物品掉落特效; addInvoke(dropToFloor, go, dropPos, 1); if (mCounter.ContainsKey(et)) { mCounter[et]++; } else { mCounter.Add(et, 1); } checkCostObjIsShow(et); // SHOW_MILLION_SEC毫秒后执行moveToBag操作; addInvoke(moveToBag, go, getBagLocalPositionByEgg(et), SHOW_MILLION_SEC); // SHOW_MILLION_SEC毫秒后执行计数检测操作; addInvoke(removeCounter, go, et, SHOW_MILLION_SEC + (int)(FLY_TO_BAG_SEC * 1000)); //string content = StringHelper.GetString("egg_get_item") + ItemManager.getItemNameWithColor(items[i].itemid) + " X " + items[i].itemnum; //PopTipManager.Instance.AddNewTip(content); PopTipManager.Instance.AddGetItemTip(items[i].itemid, items[i].itemnum); } }
void removeCounter(GameObject go, object param) { EggType et = (EggType)param; if (!mCounter.ContainsKey(et)) { return; } else { --mCounter[et]; } checkCostObjIsShow(et); }
/// <summary> /// 是否显示每个蛋的“价格”信息; /// </summary> /// <param name="et"></param> void checkCostObjIsShow(EggType et) { if (et == EggType.Normal) { return; } if (!mCounter.ContainsKey(et)) { costLb[(int)et - 1].transform.parent.gameObject.SetActive(true); } else { costLb[(int)et - 1].transform.parent.gameObject.SetActive(mCounter[et] <= 0); } }
public override string GetDisplayName(SubsystemTerrain subsystemTerrain, int value) { EggType eggType = GetEggType(Terrain.ExtractData(value)); int data = Terrain.ExtractData(value); bool isCooked = GetIsCooked(data); bool isLaid = GetIsLaid(data); if (isCooked) { return(LanguageControl.Get(fName, 1) + eggType.DisplayName); } if (!isLaid) { return(eggType.DisplayName); } return(LanguageControl.Get(fName, 2) + eggType.DisplayName); }
GameObject createItem(EggType et, role_egg_item_items item, GameObject parent) { GameObject go = WindowManager.Instance.CloneGameObject(mEggGoodsPrefab); if (go == null) { return(null); } go.SetActive(false); go.name = item.itemid.ToString(); go.transform.parent = parent.transform; go.transform.localScale = Vector3.one; go.transform.localPosition = ITEM_DROP_START_POS; go.SetActive(true); EggGoodsUI goodsItem = new EggGoodsUI(go); bool isShowAni = EggModule.GetItemIsInShowItems(item.itemid); goodsItem.SetData(item.itemid, item.itemnum, isShowAni); return(go); }
/// <summary> /// 开蛋成功结果; /// </summary> /// <param name="idx"></param> public void OpenEggSucess(EggType et, List <role_egg_item_items> items) { Pdm.AddEggOpenTimes(et); if (et == EggType.Normal) { ResetTimeCounter(EggType.Normal); } else { if (GetSecondsByEggId(et) <= 0) { ResetTimeCounter(et); } } EggUIEvent ev = new EggUIEvent(EggUIEvent.EGG_OPEN_SUCESS); ev.eggType = et; ev.items = items; EventSystem.Instance.PushEvent(ev); }
public EggBasket(EggType[] rarity) { this.rarity = rarity[new Random().Next(0, rarity.Length)]; }
public EggBasket(EggType rarity) { this.rarity = rarity; }
public bool SetTimeCounter(EggType et, int seconds) { mEggData[(int)et - 1].time_second = seconds; return(true); }
public void SetTimedEgg(Point3D location, Map map, EggType eggType) { int eggHue = Hue = Utility.RandomMinMax(2, 362); DecoyEasterEgg decoyEasterEgg = new DecoyEasterEgg(); decoyEasterEgg.Hue = eggHue; decoyEasterEgg.MoveToWorld(location, map); int delayTime = Utility.RandomMinMax(1, 10); Effects.SendLocationParticles(EffectItem.Create(location, map, TimeSpan.FromSeconds(0.25)), 0x9B5, 10, delayTime * 25, eggHue, 0, 5029, 0); Timer.DelayCall(TimeSpan.FromSeconds(delayTime), delegate { if (decoyEasterEgg != null) { if (!decoyEasterEgg.Deleted) { if (decoyEasterEgg.ParentEntity is PlayerMobile) { PlayerMobile pm_Owner = decoyEasterEgg.ParentEntity as PlayerMobile; pm_Owner.SendMessage("The eggs you gathered appear to be some sort of decoy, and they crumble in your backpack..."); pm_Owner.SendSound(0x134); } decoyEasterEgg.Delete(); } } int radius = 2; int effectSound = 0; switch (eggType) { case EggType.Explosive: effectSound = 0x359; break; case EggType.Entangle: effectSound = 0x211; break; case EggType.Poison: effectSound = 0x22F; break; case EggType.Ice: effectSound = 0x64F; break; case EggType.Banish: effectSound = 0x655; break; case EggType.Gust: effectSound = 0x64C; break; case EggType.Bloody: effectSound = 0x62B; break; } Effects.PlaySound(location, map, effectSound); Dictionary <Point3D, double> m_ExplosionLocations = new Dictionary <Point3D, double>(); m_ExplosionLocations.Add(location, 0); for (int a = 1; a < radius + 1; a++) { m_ExplosionLocations.Add(new Point3D(location.X - a, location.Y - a, location.Z), a); m_ExplosionLocations.Add(new Point3D(location.X, location.Y - a, location.Z), a); m_ExplosionLocations.Add(new Point3D(location.X + a, location.Y - a, location.Z), a); m_ExplosionLocations.Add(new Point3D(location.X + a, location.Y, location.Z), a); m_ExplosionLocations.Add(new Point3D(location.X + a, location.Y + a, location.Z), a); m_ExplosionLocations.Add(new Point3D(location.X, location.Y + a, location.Z), a); m_ExplosionLocations.Add(new Point3D(location.X - a, location.Y + a, location.Z), a); m_ExplosionLocations.Add(new Point3D(location.X - a, location.Y, location.Z), a); } foreach (KeyValuePair <Point3D, double> pair in m_ExplosionLocations) { Timer.DelayCall(TimeSpan.FromSeconds(pair.Value * .25), delegate { switch (eggType) { case EggType.Explosive: Effects.SendLocationParticles(EffectItem.Create(pair.Key, map, TimeSpan.FromSeconds(0.5)), 0x36BD, 20, 10, 5044); break; case EggType.Entangle: radius = 3; Effects.SendLocationParticles(EffectItem.Create(pair.Key, map, TimeSpan.FromSeconds(.5)), 0x3973, 10, 50, 5029); break; case EggType.Poison: Effects.SendLocationParticles(EffectItem.Create(pair.Key, map, TimeSpan.FromSeconds(0.5)), 0x372A, 10, 20, 59, 0, 5029, 0); break; case EggType.Ice: radius = 3; Effects.SendLocationParticles(EffectItem.Create(pair.Key, map, TimeSpan.FromSeconds(0.25)), 0x3779, 10, 20, 1153, 0, 5029, 0); break; case EggType.Banish: radius = 3; Effects.SendLocationParticles(EffectItem.Create(pair.Key, map, TimeSpan.FromSeconds(.25)), 0x3763, 10, 20, 2199, 0, 5029, 0); break; case EggType.Gust: radius = 4; Effects.SendLocationParticles(EffectItem.Create(pair.Key, map, TimeSpan.FromSeconds(.25)), 0x1FB2, 10, 20, 0, 0, 5029, 0); break; case EggType.Bloody: Effects.SendLocationParticles(EffectItem.Create(pair.Key, map, TimeSpan.FromSeconds(.25)), Utility.RandomList(0x1645, 0x122A, 0x122B, 0x122C, 0x122D, 0x122E, 0x122F), 10, 20, 0, 0, 5029, 0); break; } }); } List <Mobile> m_TargetsHit = new List <Mobile>(); IPooledEnumerable eable = map.GetMobilesInRange(location, radius); foreach (Mobile mobile in eable) { if (mobile is EasterBunny) { continue; } if (!mobile.CanBeDamaged()) { continue; } m_TargetsHit.Add(mobile); } eable.Free(); int targets = m_TargetsHit.Count; for (int a = 0; a < targets; a++) { double damage = 0; Mobile mobile = m_TargetsHit[a]; if (mobile == null) { continue; } if (!mobile.Alive || mobile.Deleted) { continue; } switch (eggType) { case EggType.Explosive: damage = (double)(Utility.RandomMinMax(20, 40)); if (mobile is BaseCreature) { damage *= 1.5; } AOS.Damage(mobile, (int)damage, 0, 100, 0, 0, 0); break; case EggType.Entangle: if (mobile != null) { SpecialAbilities.EntangleSpecialAbility(1.0, null, mobile, 1, 10, -1, true, "", "You are held in place!", "-1"); } break; case EggType.Poison: Poison poison = Poison.GetPoison(Utility.RandomMinMax(2, 4)); mobile.ApplyPoison(mobile, poison); break; case EggType.Ice: damage = (double)(Utility.RandomMinMax(10, 20)); if (mobile is BaseCreature) { damage *= 1.5; } SpecialAbilities.CrippleSpecialAbility(1.0, null, mobile, .5, 10, -1, true, "", "A blast of ice has slowed your actions!", "-1"); AOS.Damage(mobile, (int)damage, 0, 100, 0, 0, 0); break; case EggType.Gust: SpecialAbilities.KnockbackSpecialAbility(1.0, Location, null, mobile, 40, 8, -1, "", "A gust of wind knocks you off your feet!"); break; case EggType.Banish: SpecialAbilities.HinderSpecialAbility(1.0, null, mobile, 1.0, 5, false, -1, false, "", "You cannot move or speak!", "-1"); mobile.Squelched = true; mobile.Hidden = true; Timer.DelayCall(TimeSpan.FromSeconds(5), delegate { if (mobile == null) { return; } mobile.Squelched = false; mobile.Hidden = false; }); break; case EggType.Bloody: SpecialAbilities.BleedSpecialAbility(1.0, null, mobile, 40, 8.0, 0x44D, true, "", "You begin to bleed!", "-1"); break; } } }); }
public void SetData(EggType et, EggItemData data) { mEggData[(int)et - 1] = data; }
public int GetTimeSeconds(EggType et) { return(mEggData[(int)et - 1].time_second); }
public int GetOpenTimes(EggType et) { return(mEggData[(int)et - 1].times); }