// Use this for initialization void Start() { fleetManagerScript = gameObject.GetComponent <FleetManager>(); randomEventManagerScript = gameObject.GetComponent <RandomEventManager>(); startTime = Time.time; GameOverScreen.gameObject.SetActive(false); gameEnd = false; gameEndCalculator = GameObject.FindGameObjectWithTag("gameEndCalculator").GetComponent <GameEndCalculator>(); }
public void NextWave() { if (currentWave == maxWave / 2) { currentWave++; RandomEventManager.RandomEvent(); } else { StartCoroutine("FirstWaveCycleSpawn"); } }
// Start is called before the first frame update void Awake() { if (_instance != null && this != _instance) { Destroy(this.gameObject); } else { _instance = this; minorEventAnimator = minorEventPanel.GetComponent <Animator>(); } }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
// Use this for initialization void OnEnable() { minSecurityLevel = minSecurityLevel * 0.01f; eventName.text = (eventNameString); startTime = Time.time; fleetManagerScript = GameObject.FindGameObjectWithTag("GameController").GetComponent <FleetManager>(); randomEventManagerScript = GameObject.FindGameObjectWithTag("GameController").GetComponent <RandomEventManager>(); reducePopPercentBy = reducePopPercentBy * 0.01f; reduceAirBy = reduceAirBy * 0.01f; reduceFuelBy = reduceFuelBy * 0.01f; reduceFoodBy = reduceFoodBy * 0.01f; eventEnd = false; pauseTime = 0f; }
private void GetGiftSuccess(ReceiveFreeTriggerGiftRes res) { LoadingOverlay.Instance.Hide(); RewardUtil.AddReward(res.Award); AwardWindow awardWindow = PopupManager.ShowWindow <AwardWindow>("GameMain/Prefabs/AwardWindow/AwardWindow"); awardWindow.SetData(res.Award); awardWindow.WindowActionCallback = evt => { RandomEventManager.ShowGiftWindow(_currentIndex); }; GlobalData.RandomEventModel.UpdateDate(res.UserTriggerGift); Close(); }
private void FilterNewGift(RepeatedField <UserTriggerGiftPB> oldTriggerGiftPb, RepeatedField <UserTriggerGiftPB> newTriggerGiftPb, bool showNewGiftWindow) { GiftCount = 0; _newGifts = new List <UserTriggerGiftPB>(); foreach (var giftPb in newTriggerGiftPb) { bool hasGift = false; if (_oldGift != null) { foreach (var oldPb in _oldGift) { if (giftPb.Id == oldPb.Id) { hasGift = true; break; } } } if (hasGift == false) { _newGifts.Add(giftPb); } } _oldGift = newTriggerGiftPb; GiftList = new List <TriggerGiftVo>(); foreach (var giftPb in newTriggerGiftPb) { GiftCount++; RmbMallRulePB pb = GetMallPb(giftPb.MallId); bool hasFree = false; foreach (var rule in _triggerGiftsRule) { if (rule.MallId == giftPb.MallId && giftPb.FreeType == 0 && rule.FreeAward != null && rule.FreeAward.Count > 0) { TriggerGiftVo vo1 = new TriggerGiftVo(); vo1.Id = giftPb.Id; vo1.IsFree = true; vo1.MallId = giftPb.MallId; vo1.FreeType = giftPb.FreeType; vo1.MaturityTime = giftPb.MaturityTime; vo1.Awards = rule.FreeAward; vo1.Rule = pb; GiftList.Add(vo1); hasFree = true; break; } } if (giftPb.FreeType == 1 || hasFree == false) { //免费礼包领取之后才会显示收费礼包 TriggerGiftVo vo = new TriggerGiftVo(); vo.Id = giftPb.Id; vo.MallId = giftPb.MallId; vo.FreeType = giftPb.FreeType; vo.MaturityTime = giftPb.MaturityTime; vo.IsFree = false; vo.Awards = pb.Award; vo.Rule = pb; GiftList.Add(vo); } } GiftList.Sort(); if (showNewGiftWindow) { RandomEventManager.ShowNewTriggerGift(); } EventDispatcher.TriggerEvent(EventConst.OnTriggerGiftChange); }
private void OnEnable() { spawnpoints = GameObject.FindGameObjectsWithTag("spawnpoint"); randEvMan = GameObject.FindGameObjectWithTag("GameController").GetComponent <RandomEventManager>(); gameEndCalculator = GameObject.FindGameObjectWithTag("gameEndCalculator").GetComponent <GameEndCalculator>(); enabledTime = Time.time; timeToChoose = Mathf.RoundToInt(Random.Range(minTime, maxTime)); shipStatScript = GetComponentInChildren <ShipStartStats>(); shipToSpawn = shipStatScript.gameObject; int howMuchFood = Mathf.RoundToInt(Random.Range(minResourceCount, maxResourceCount)); int howMuchAir = Mathf.RoundToInt(Random.Range(minResourceCount, maxResourceCount)); int howMuchFuel = Mathf.RoundToInt(Random.Range(minResourceCount, maxResourceCount)); //show food air fuel in UI airCount.text = (howMuchAir + " AIR"); foodCount.text = (howMuchFood + " FUEL"); fuelCount.text = (howMuchFuel + " FOOD"); //population randomiser int whichPopulation = Mathf.RoundToInt(Random.Range(0, 6)); int populationModifier = Mathf.RoundToInt(Random.Range(0, shipStatScript.StartingPopModifier)); if (whichPopulation >= 0 && whichPopulation < 1) { shipStatScript.StartingPopR = shipStatScript.StartingPopR + populationModifier; shipStatScript.StartingPopG = 0; shipStatScript.StartingPopB = 0; shipStatScript.startingFood = howMuchFood; shipStatScript.startingAir = howMuchAir; shipStatScript.startingFuel = howMuchFuel; popCountNType.text = ("Population On Board: " + "\n" + "\n" + shipStatScript.StartingPopR + " Redsles" + "\n" + "\n" + "Redsles are strong and resilient, great in security and defence roles, but low in intelligence"); } else if (whichPopulation >= 1 && whichPopulation < 2) { shipStatScript.StartingPopR = 0; shipStatScript.StartingPopG = shipStatScript.StartingPopG + populationModifier; shipStatScript.StartingPopB = 0; shipStatScript.startingFood = howMuchFood; shipStatScript.startingAir = howMuchAir; shipStatScript.startingFuel = howMuchFuel; popCountNType.text = ("Population On Board: " + "\n" + "\n" + shipStatScript.StartingPopG + " Greenies" + "\n" + "\n" + "Greenies are very intelligent and good at production, but not very good in conflict"); } else if (whichPopulation >= 2 && whichPopulation <= 6) { shipStatScript.StartingPopR = 0; shipStatScript.StartingPopG = 0; shipStatScript.StartingPopB = shipStatScript.StartingPopG + populationModifier; shipStatScript.startingFood = howMuchFood; shipStatScript.startingAir = howMuchAir; shipStatScript.startingFuel = howMuchFuel; popCountNType.text = ("Population On Board: " + "\n" + "\n" + shipStatScript.StartingPopB + " Bluehoos" + "\n" + "\n" + "Bluehoos are sad all the time, don't work well with others and consume large quantities of food and air"); } }
// Use this for initialization void Start() { spawnpoints = GameObject.FindGameObjectsWithTag("spawnpoint"); randEvMan = GameObject.FindGameObjectWithTag("GameController").GetComponent <RandomEventManager>(); gameEndCalculator = GameObject.FindGameObjectWithTag("gameEndCalculator").GetComponent <GameEndCalculator>(); }
private void ShowTriggerGift() { RandomEventManager.ShowGiftWindow(); }
private void ShowGift() { ClientData.LoadItemDescData(null); ClientData.LoadSpecialItemDescData(null); var npcId = GlobalData.PlayerModel.PlayerVo.NpcId; var npcImg = transform.GetRawImage("window/RoleImage" + npcId); npcImg.texture = ResourceManager.Load <Texture>("Background/PersonIcon/Npc" + npcId, null, true); npcImg.gameObject.Show(); _triggerGiftVo = _list[_currentIndex]; _titleText.text = _triggerGiftVo.Rule.MallName; _desc.text = _triggerGiftVo.Rule.MallDesc; List <RewardVo> rewardList = _triggerGiftVo.GetRewardList(); for (int i = 0; i < _content.childCount; i++) { Transform child = _content.GetChild(i); if (i < rewardList.Count) { child.GetRawImage("Image").texture = ResourceManager.Load <Texture>(rewardList[i].IconPath, null, true); child.GetText("NumText").text = rewardList[i].Num.ToString(); } if (i < rewardList.Count) { RewardVo vo = rewardList[i]; PointerClickListener.Get(child.gameObject).onClick = go => { FlowText.ShowMessage(ClientData.GetItemDescById(vo.Id, vo.Resource).ItemDesc); }; } child.gameObject.SetActive(i < rewardList.Count); } // RectTransform rect = _buyBtnText.transform.GetRectTransform(); if (_triggerGiftVo.IsFree) { _buyBtnText.gameObject.Hide(); _freeBtnText.gameObject.Show(); _freeBtnText.text = I18NManager.Get("RandowEventWindow_Free"); _originalPriceText.gameObject.Hide(); // rect.sizeDelta = new Vector2(920, rect.sizeDelta.y); } else { ProductVo product = GlobalData.PayModel.GetProduct(_triggerGiftVo.MallId); _buyBtnText.text = product.AreaPrice;//product.Curreny + " " + _buyBtnText.gameObject.Show(); _freeBtnText.gameObject.Hide(); _originalPriceText.gameObject.Show(); if (AppConfig.Instance.isChinese == "true" || product?.Curreny == Constants.CHINACURRENCY) { _originalPriceText.text = I18NManager.Get("RandowEventWindow_OriginalPrice") + _triggerGiftVo.Rule.OriginalPrice + "元"; } else { _originalPriceText.text = I18NManager.Get("RandowEventWindow_OriginalPrice") + product.Curreny + " " + product.GetOriginalPrice(_triggerGiftVo.Rule.OriginalPrice); } // rect.sizeDelta = new Vector2(920-100, rect.sizeDelta.y); } ClientTimer.Instance.RemoveCountDown(_countName); _timeText.text = I18NManager.Get("RandowEventWindow_Time", DateUtil.GetTimeFormat4(_triggerGiftVo.MaturityTime - ClientTimer.Instance.GetCurrentTimeStamp())) + I18NManager.Get("RandowEventWindow_Later"); ClientTimer.Instance.AddCountDown(_countName, long.MaxValue, 1, tick => { if (_triggerGiftVo.MaturityTime - ClientTimer.Instance.GetCurrentTimeStamp() <= 0) { Close(); GlobalData.RandomEventModel.Delete(new RepeatedField <long>() { _triggerGiftVo.Id }); RandomEventManager.ShowGiftWindow(_currentIndex); return; } _timeText.text = I18NManager.Get("RandowEventWindow_Time", DateUtil.GetTimeFormat4( _triggerGiftVo.MaturityTime - ClientTimer.Instance.GetCurrentTimeStamp())) + I18NManager.Get("RandowEventWindow_Later"); }, null); _leftBtn.gameObject.SetActive(_list.Count > 1); _rightBtn.gameObject.SetActive(_list.Count > 1); }