public void DailySign(float multiple) { if (!CanDailySign()) { DispatchEvent(EventGameData.Action.Error, LTKey.DAILY_SIGN_CANT_SIGN); return; } var days = localData.signDays; localData.signDays = (days % 7) + 1; localData.lastSignDateTicks = DateTime.Now.Date.Ticks; var t = TableDailySign.Get(days); if (t.type == 1) { AddDiamondWithEffect(t.count); } else if (t.type == 2) { AddCoin(t.count * multiple * FormulaUtil.Expresso(CT.table.formulaArgsDailySignCoin)); } SaveLocalData(); DispatchEvent(EventGameData.Action.DataChange); Analytics.Event.DailySign(days, multiple); }
private void Refresh() { costText.text = mCurrent.KMB(); gainText.text = (mCurrent * FormulaUtil.Expresso(CT.table.formulaArgsCoinExchange)).KMB(); subBtn.SetBtnGrey(mCurrent <= 0); addBtn.SetBtnGrey(mCurrent >= D.I.diamond); exchangeBtn.SetBtnGrey(mCurrent <= 0); }
protected override void OnInit() { base.OnInit(); mTableGameLevel = TableGameLevel.Get(D.I.gameLevel); mSpawnCountFix = FormulaUtil.Expresso(CT.table.formulaArgsVirusSpawnCount); mWaveModule.Init(); mBuffGenModule.Init(); Unibus.Subscribe <EventAircraft>(OnEventAircraft); Unibus.Subscribe <EventVirus>(OnEventVirus); }
private void ResetFixFactor() { if (mFirePower <= tableGameLevel.firePowerLimitation) { mHpFixFactor = 1; mSpeedFixFactor = 1; mSpawnCountFixFactor = 1; } else { mHpFixFactor = FormulaUtil.Expresso(CT.table.formulaArgsVirusHp); mSpawnCountFixFactor = FormulaUtil.Expresso(CT.table.formulaArgsVirusSpawnCount); mSpeedFixFactor = 1; } }
public void ExchangeCoin(float diamond) { if (diamond > this.diamond) { DispatchEvent(EventGameData.Action.Error, LTKey.EXCHANGE_DIAMOND_NOT_ENOUGH.LT()); return; } localData.diamond -= diamond; var addCoin = diamond * FormulaUtil.Expresso(CT.table.formulaArgsCoinExchange); localData.coin += addCoin; SaveLocalData(); DispatchEvent(EventGameData.Action.DataChange); Analytics.Event.Exchange(diamond, addCoin); }
public void SetData(int days) { var t = TableDailySign.Get(days); title.text = LT.Get(t.nameID); image.SetSprite(t.icon); if (t.type == 2) // coin { count.text = "x" + t.count * FormulaUtil.Expresso(CT.table.formulaArgsDailySignCoin); } else { count.text = "x" + t.count; } if (days == D.I.signDays) { if (D.I.CanDailySign()) { stateRadio.Radio(1); } else { stateRadio.Radio(0); } } else { if (days < D.I.signDays) { stateRadio.Radio(2); } else { stateRadio.Radio(0); } } bgRadio.Radio(stateRadio.index); btn.clickEventID = days; }