// Use this for initialization void Start() { _dataCtrl = WGDataController.Instance; dicAchievement = _dataCtrl.dicGoalAchieve; lastChangeTime = Time.realtimeSinceStartup; InvokeRepeating("AutoSave", 2, 40); }
void Awake() { DontDestroyOnLoad(this.gameObject); Instance = this; Core.Initialize(); mTurnRandom = new WGRandom(); }
public void freshWithCollectionID(int id, Color color) { WGDataController _dataCtrl = WGDataController.Instance; mItemColID = id; labNum.text = _dataCtrl.GetCollectionOwnNum(id).ToString(); BCObj obj = _dataCtrl.GetBCObj(id); if (obj != null) { GameObject go = Instantiate(obj.goRes, Vector3.zero, Quaternion.Euler(270, 0, 0)) as GameObject; Vector3 scale = go.transform.localScale; go.transform.parent = this.transform; go.transform.localScale = Vector3.one * 14.6f; go.transform.localPosition = goCollectionPanel.transform.localPosition; go.transform.parent = goCollectionPanel.transform; Destroy(go.GetComponent <Rigidbody>()); Destroy(go.GetComponent <BoxCollider>()); goCollectionPanel.GetComponent <TweenRotation>().delay = Random.Range(0, 1); } spBackground.color = color; spBottom.color = color; }
public override void OnBtnOk() { BCSoundPlayer.Play(MusicEnum.button); DataPlayerController dpc = DataPlayerController.getInstance(); WGDataController _dataCtrl = WGDataController.Instance; int numleft = _dataCtrl.GetCollectionOwnNum(itemID1); int numMiddle = _dataCtrl.GetCollectionOwnNum(itemID2); int numRight = _dataCtrl.GetCollectionOwnNum(itemID3); if (Mathf.Min(numleft, numMiddle, numRight) >= mSellCount) { _dp.Coin += Mathf.CeilToInt(mGotCoin + 0.5f); dpc.addCollectionNum(itemID1, -mSellCount); dpc.addCollectionNum(itemID2, -mSellCount); dpc.addCollectionNum(itemID3, -mSellCount); // Dictionary<string, object> dic = new Dictionary<string, object>(); // dic.Add("SellNum",mSellCount.ToString()); // //WG.SLog("=actionId="+WGStrings.getText(9005)+col1.groupdes+"==parameters="+SDK.Serialize(dic)); // // TalkingDataGA.OnEvent(WGStrings.getText(9005)+col1.groupdes, dic); //#endif DataPlayerController.getInstance().saveDataPlayer(); WGGameUIView.Instance.freshPlayerUI(UI_FRESH.COIN); } WGGameUIView.Instance.freshMenuButton(2); base.OnBtnOk(); }
public void freshUIWithData(MDAchievement ach) { preAchievementData = ach; WGDataController _dataCtrl = WGDataController.Instance; DataPlayerController dpc = DataPlayerController.getInstance(); BCObj rwObj = _dataCtrl.GetBCObj(ach.reward[0]); labName.text = ach.name + ":" + ach.des; spGoalIcon.spriteName = ach.icon; switch (rwObj.BCType) { case BCGameObjectType.Coin: spRewardIcon.spriteName = "coin_105"; break; case BCGameObjectType.Jewel: spRewardIcon.spriteName = "gem_104"; break; } spRewardIcon.MakePixelPerfect(); labRewardNum.text = WGStrings.getFormate(1066, ach.reward[1]); int got = 0; dpc.data.dicGotAchReward.TryGetValue(ach.id, out got); if (got == 1) //到达了 { btnGetReward.gameObject.SetActive(true); sdProgress.gameObject.SetActive(false); goHaveGot.SetActive(false); } else if (got == 0) //还没有到达 { goHaveGot.SetActive(false); btnGetReward.gameObject.SetActive(false); sdProgress.gameObject.SetActive(true); int reachNum = WGAchievementManager.Self.getAchievementProgress(ach); labProgress.text = reachNum.ToString() + "/" + ach.goal_num.ToString(); sdProgress.value = reachNum * 1f / ach.goal_num; } else if (got == -1) //已经领取 { goHaveGot.SetActive(true); btnGetReward.gameObject.SetActive(false); sdProgress.gameObject.SetActive(false); } }
public void InitWithGameWorld(WGGameWorld World) { _sp = Core.fc.sp; szBigBear = new List <int>() { WGDefine.BossID, WGDefine.PayBear1, WGDefine.PayBear2 }; _EnergyFull = Core.fc.EnergyFull; Speed = _sp.SPEED_commen; if (_dataPlayer.DelAD == 0) { #if Add_AD wuqiTran.localPosition = Core.fc.weaponsPos1; #else wuqiTran.localPosition = Core.fc.weaponsPos; #endif } else { wuqiTran.localPosition = Core.fc.weaponsPos; } TongueRoot.ESetActive(true); mTurnPlate.v3Rotate = Core.fc.turnPlateComm; csRoteTp.V = Core.fc.turnPlateComm.z / 40.0f;//result is 0.3 tDeskPanel.localPosition = Core.fc.deskPos; coinDropBox.transform.localPosition = Core.fc.boxCoin.pos; coinDropBox.size = Core.fc.boxCoin.size; coinDropBox.center = Core.fc.boxCoin.center; collectionDropBox.transform.localPosition = Core.fc.boxColletion.pos; collectionDropBox.size = Core.fc.boxColletion.size; collectionDropBox.center = Core.fc.boxColletion.center; pgHaiXiao.value = _dataPlayer.mEnergy * 1.0f / _EnergyFull; _ShareWorld = World; dataCtrl = WGDataController.Instance; _ShareObjManager = World.cs_ObjManager; _TongueSide = _sp.Backward; _TurnPlateTrans = BearRoot.transform; _DeadBearList = new Queue <Transform>(); TreeTween.gameObject.SetActive(false); goIceDesk.SetActive(false); ResetAllBear(); }
public void FreshUnlockBearView(int id) { WGDataController _dtCtl = WGDataController.Instance; mBearObj = _dtCtl.GetBCObj(id); // WGBearParam bp = _dtCtl.GetBearParam(id); labName.text = mBearObj.Name; ShowOneBear.getInstance(); }
void OnBtnSell() { BCSoundPlayer.Play(MusicEnum.button); WGDataController _dataCtrl = WGDataController.Instance; // DataPlayerController dpc = DataPlayerController.getInstance(); if (mCanSellNum > 0) { WGSellGroupItemView sgv = WGSellGroupItemView.CreateSellGroupItemView(); SDK.AddChild(sgv.gameObject, WGRootManager.Self.goRootTopUI); sgv.FreshSellGroupWithID(mObjID1, mObjID2, mObjID3, mCanSellNum); sgv.alertViewBehavriour = (ab, view) => { switch (ab) { case MDAlertBehaviour.CLICK_OK: { view.hiddenView(); FreshUI(); } break; case MDAlertBehaviour.CLICK_CANCEL: view.hiddenView(); break; case MDAlertBehaviour.DID_HIDDEN: Destroy(view.gameObject); break; } }; return; } else { WGAlertViewController.Self.showAlertView(1011).alertViewBehavriour = (ab, view) => { switch (ab) { case MDAlertBehaviour.CLICK_OK: view.hiddenView(); break; case MDAlertBehaviour.DID_HIDDEN: WGAlertViewController.Self.hiddeAlertView(view.gameObject); break; } }; } }
void FreshUI() { WGDataController dc = WGDataController.Instance; for (int i = 0; i < dc.szHuaFei.Count; i++) { MDV2HuaFei hf = dc.szHuaFei[i]; HuaFei_CellView hc = HuaFei_CellView.CreateHuaFeiView(); SDK.AddChild(hc.gameObject, tsContent.gameObject); hc.transform.localPosition = new Vector3(0, 149 - i * 96, 0); hc.freshUI(hf); } }
public void FreshSellGroupWithID(int id1, int id2, int id3, int max) { maxCount = max; itemID1 = id1; itemID2 = id2; itemID3 = id3; WGDataController _dataCtrl = WGDataController.Instance; col1 = _dataCtrl.GetCollectionInfo(itemID1); col2 = _dataCtrl.GetCollectionInfo(itemID2); col3 = _dataCtrl.GetCollectionInfo(itemID3); mSellCount = max; freshSellView(); }
public void InitScrollView() { if (bInit) { return; } bInit = true; _dataCtrl = WGDataController.Instance; Dictionary <int, List <int> > dicCollections = new Dictionary <int, List <int> >(); for (int i = 0; i < _dataCtrl.szCollectionObj.Count; i++) { BCObj obj = _dataCtrl.szCollectionObj[i]; BCCollectionInfo col = _dataCtrl.GetCollectionInfo(obj.ID); List <int> szTemp; if (dicCollections.TryGetValue(col.groupID, out szTemp)) { szTemp.Add(obj.ID); } else { szTemp = new List <int>(); szTemp.Add(obj.ID); dicCollections.Add(col.groupID, szTemp); } } int index = 0; foreach (KeyValuePair <int, List <int> > kvp in dicCollections) { CItemCollectionCell cell = CItemCollectionCell.CreateCollectionCell(); cell.transform.parent = this.transform; cell.transform.localScale = Vector3.one; cell.transform.localPosition = new Vector3(0, 200 - index * 236, 0); szCollectionCell.Add(cell); Color color = Color.gray; if (index <= szColors.Length) { color = szColors[index]; } cell.freshWithCollections(kvp.Value.ToArray(), szColors[index]); cell.SetDragCamera(dragCamera); index++; } }
public void freshItem() { WGDataController _dataCtrl = WGDataController.Instance; Dictionary <int, List <int> > dicCollections = new Dictionary <int, List <int> >(); for (int i = 0; i < _dataCtrl.szCollectionObj.Count; i++) { BCObj obj = _dataCtrl.szCollectionObj[i]; BCCollectionInfo col = _dataCtrl.GetCollectionInfo(obj.ID); List <int> szTemp; if (dicCollections.TryGetValue(col.groupID, out szTemp)) { szTemp.Add(obj.ID); } else { szTemp = new List <int>(); szTemp.Add(obj.ID); dicCollections.Add(col.groupID, szTemp); } } int index = 0; bool showTips = false; foreach (KeyValuePair <int, List <int> > kvp in dicCollections) { int [] ids = kvp.Value.ToArray(); if (ids.Length >= 3) { int left = _dataCtrl.GetCollectionOwnNum(ids[0]); int center = _dataCtrl.GetCollectionOwnNum(ids[1]); int right = _dataCtrl.GetCollectionOwnNum(ids[2]); if (Mathf.Min(left, center, right) > 0) { showTips = true; break; } } } spItemComplet.ESetActive(showTips); }
// public void DonotNeedCoin(float time) // { // CancelInvoke("retNeedCoin"); // bNeedCoin = false; // Invoke("retNeedCoin",time); // } // void retNeedCoin() // { // bNeedCoin = true; // } void Start() { if (dp.DelAD == 0) { Up = Up_Add; } else { Up = upTemp; } _ShareWorld = WGGameWorld.Instance; _dataCtrl = WGDataController.Instance; // for(int i=0;i<_dataCtrl.szWeapons.Count;i++) // { // WGWeapon wep = WGWeapon.CreateWeapon(i); // wep.gameObject.SetActive(false); // wep.transform.parent = this.transform; // wep.transform.localPosition = Vector3.zero; // wep.transform.localRotation = Quaternion.Euler(Vector3.zero); // wep.transform.localScale = Vector3.one; // szWeaponGO.Add(wep); // } mWeaponIndex = 0; // _Weapon = szWeaponGO[0]; _Weapon = WGWeapon.CreateWeapon(); SDK.AddChild(_Weapon.gameObject, this.gameObject); _Weapon.transform.localPosition = new Vector3(0, 0, -0.99f); // _Weapon.labCostCoin = labCostNum; _Weapon.ESetActive(true); _weaponData = _dataCtrl.szWeapons[0]; UIEventListener.Get(goEvent).onPress += this.myOnPress; CheckStaticWeapon(); }
void freshWithThreeCollection(int id1, int id2, int id3, Color color) { mObjID1 = id1; mObjID2 = id2; mObjID3 = id3; spTitleBackground.color = color; WGDataController _dataCtrl = WGDataController.Instance; int numleft = _dataCtrl.GetCollectionOwnNum(id1); int numMiddle = _dataCtrl.GetCollectionOwnNum(id2); int numRight = _dataCtrl.GetCollectionOwnNum(id3); mCanSellNum = Mathf.Min(numleft, numMiddle, numRight); BCCollectionInfo bci = WGDataController.Instance.GetCollectionInfo(id1); labGroupName.text = bci.groupdes; labGroupNum.text = mCanSellNum.ToString(); CItemCollectionCellView leftCell = CItemCollectionCellView.CreateCollectionCellView(); AddCell(leftCell.gameObject, goLeft); leftCell.freshWithCollectionID(id1, color); szItemColCell.Add(leftCell); CItemCollectionCellView middelCell = CItemCollectionCellView.CreateCollectionCellView(); AddCell(middelCell.gameObject, goMiddel); middelCell.freshWithCollectionID(id2, color); szItemColCell.Add(middelCell); CItemCollectionCellView rightCell = CItemCollectionCellView.CreateCollectionCellView(); AddCell(rightCell.gameObject, goRight); rightCell.freshWithCollectionID(id3, color); szItemColCell.Add(rightCell); }
public void FreshUI() { WGDataController _dataCtrl = WGDataController.Instance; for (int i = 0; i < szItemColCell.Count; i++) { szItemColCell[i].refreshView(); } int numleft = _dataCtrl.GetCollectionOwnNum(mObjID1); int numMiddle = _dataCtrl.GetCollectionOwnNum(mObjID2); int numRight = _dataCtrl.GetCollectionOwnNum(mObjID3); mCanSellNum = Mathf.Min(numleft, numMiddle, numRight); labGroupNum.text = mCanSellNum.ToString(); if (mCanSellNum > 0) { spTip.gameObject.SetActive(true); } else { spTip.gameObject.SetActive(false); } }
void initView() { _dataCtrl = WGDataController.Instance; }
void showBuyPowerView() { WGDataController _dataCtrl = WGDataController.Instance; YHMDPayData payData = _dataCtrl.getYHMDPay(YHPayType.POWER); float costMenoy = payData.payCost; string payKey = payData.payKey.ToString(); // string paykey = "112"; // float costMenoy = 30f; // if(YeHuoSDK.bUsePayCode2) // { // paykey = "212"; // costMenoy = 20f; // } string okString = "ok"; #if YES_OK string content = WGStrings.getFormateInt(1081, 1002, 8209, costMenoy.ToString()); okString = WGStrings.getText(1002); #elif YES_BUY string content = WGStrings.getFormateInt(1081, 1094, 8209, costMenoy.ToString()); okString = WGStrings.getText(1094); #elif YES_GET string content = WGStrings.getFormateInt(1081, 1077, 8209, costMenoy.ToString()); okString = WGStrings.getText(1077); #elif YES_QueRen string content = WGStrings.getFormateInt(1081, 1106, payData.showText, costMenoy.ToString()); okString = WGStrings.getText(1106); #else string content = WGStrings.getFormateInt(1081, 1077, payData.showText, costMenoy.ToString()); okString = WGStrings.getText(1077); #endif D04PowerBuyView bv = D04PowerBuyView.CreatePowerBuyView(); bv.FreshUI(content, okString); bv.alertViewBehavriour = (ab, view) => { switch (ab) { case MDAlertBehaviour.CLICK_OK: YeHuoSDK.YHPay(payKey, costMenoy, 0, (success) => { view.hiddenView(); if (success) { _dataPlayer.a1 = 1; _bShowPowerTip = false; } }); break; case MDAlertBehaviour.CLICK_CANCEL: _dataPlayer.mEnergy -= _EnergyFull; view.hiddenView(); break; case MDAlertBehaviour.DID_HIDDEN: Destroy(view.gameObject); _bShowPowerTip = false; Time.timeScale = 1; break; } }; bv.showView(); }
public void ViewDidLoad() { _dataCtrl = WGDataController.Instance; }
public void viewDidLoad() { _dataCtrl = WGDataController.Instance; mTabCollection.ViewDidLoad(); mTabMonster.ViewDidLoad(); }
void OnBtnChaoZhi() { if (!_DataPlayer.szBigReward.Contains(4)) { WGAlertManager.Self.AddAction(() => { WGDataController _dataCtrl = WGDataController.Instance; YHMDPayData payData = _dataCtrl.getYHMDPay(YHPayType.CHEAP); float costMenoy = payData.payCost; string payKey = payData.payKey.ToString(); //#if Unicom // float costMenoy = 1f; //#else // float costMenoy = 0.1f; //#endif // string payKey = "104"; // if(YeHuoSDK.bUsePayCode2) // { // payKey = "204"; // } YHGotRewardView rdview = YHGotRewardView.CreateGotRewardView(); rdview.mRType = YHRewardType.Cheap; SDK.AddChild(rdview.gameObject, WGRootManager.Self.goRootTopUI); rdview.FreshRewardCell(_dataCtrl.mAllReward.cheap); #if YES_OK string content = WGStrings.getFormateInt(1081, 1002, 1086, costMenoy.ToString()); #elif YES_BUY string content = WGStrings.getFormateInt(1081, 1094, 1086, costMenoy.ToString()); #elif YES_GET string content = WGStrings.getFormateInt(1081, 1077, 1086, costMenoy.ToString()); #elif YES_QueRen string content = WGStrings.getFormateInt(1081, 1106, payData.showText, costMenoy.ToString()); #else string content = WGStrings.getFormateInt(1081, 1077, payData.showText, costMenoy.ToString()); #endif rdview.FreshWithMsg(payData.showText, content, true, true); rdview.alertViewBehavriour = (ab, view) => { switch (ab) { case MDAlertBehaviour.CLICK_OK: { YeHuoSDK.YHPay(payKey, costMenoy, 0, (success) => { view.hiddenView(); if (success) { btnChaoZhi.ESetActive(false); _DataPlayer.szBigReward.Add(4); rdview.GetAllReward(); WGGameUIView.Instance.freshSkillNum(); WGGameUIView.Instance.freshPlayerUI(UI_FRESH.BCOIN | UI_FRESH.COIN); } }); } break; case MDAlertBehaviour.CLICK_CANCEL: view.hiddenView(); break; case MDAlertBehaviour.DID_HIDDEN: Destroy(view.gameObject); WGAlertManager.Self.RemoveHead(); WGAlertManager.Self.ShowNext(); break; } }; rdview.showView(); BCSoundPlayer.Play(MusicEnum.showReward, 1f); }); WGAlertManager.Self.ShowNext(); } }
void OnBtnGetReward() { WGDataController _dataCtrl = WGDataController.Instance; DataPlayerController dpc = DataPlayerController.getInstance(); if (dpc.data.dicGotAchReward[preAchievementData.id] != 1) { WGAlertViewController.Self.showAlertView(1016).alertViewBehavriour = (ab, view) => { switch (ab) { case MDAlertBehaviour.CLICK_OK: view.hiddenView(); break; case MDAlertBehaviour.DID_HIDDEN: WGAlertViewController.Self.hiddeAlertView(view.gameObject); break; } }; return; } int objID = preAchievementData.reward[0]; int gotNum = preAchievementData.reward[1]; BCObj obj = _dataCtrl.GetBCObj(objID); switch (obj.BCType) { case BCGameObjectType.Item: dpc.AddSkillNum(objID, gotNum); WGGameUIView.Instance.freshSkillNum(); break; case BCGameObjectType.Collection: dpc.addCollectionNum(objID, gotNum); break; case BCGameObjectType.Coin: dpc.data.Coin += gotNum; WGGameUIView.Instance.freshPlayerUI(UI_FRESH.COIN); break; case BCGameObjectType.Jewel: dpc.data.Jewel += gotNum; #if TalkingData TDGAVirtualCurrency.OnReward(gotNum, "AchievementReward"); #endif #if Umeng Umeng.GA.Bonus(gotNum, Umeng.GA.BonusSource.Source4); #endif WGGameUIView.Instance.freshPlayerUI(UI_FRESH.BCOIN); break; } dpc.data.dicGotAchReward[preAchievementData.id] = -1; // WGAlertViewController.Self.showAlertView(1015).alertViewBehavriour =(ab,view)=>{ // switch(ab) // { // case MDAlertBehaviour.CLICK_OK: // view.hiddenView(); // if(curAchViewManager != null) // { // curAchViewManager.ReloadAchievement(); // } // break; // case MDAlertBehaviour.DID_HIDDEN: // WGAlertViewController.Self.hiddeAlertView(view.gameObject); // break; // } // }; if (curAchViewManager != null) { curAchViewManager.ReloadAchievement(); } }
public void GetAllReward(bool bDouble = false, bool notgift = false) { DataPlayer _DataPlayer = DataPlayerController.getInstance().data; WGDataController _dataCtrl = WGDataController.Instance; int jewel = 0; for (int i = 0; i < szAllReward.Count; i++) { BCGameObjectType type = _dataCtrl.GetBCObjType(szAllReward[i][0]); switch (type) { case BCGameObjectType.Coin: _DataPlayer.Coin += szAllReward[i][1]; if (bDouble) { _DataPlayer.Coin += szAllReward[i][1]; } break; case BCGameObjectType.Item: DataPlayerController.getInstance().AddSkillNum(szAllReward[i][0], szAllReward[i][1]); if (bDouble) { DataPlayerController.getInstance().AddSkillNum(szAllReward[i][0], szAllReward[i][1]); } break; case BCGameObjectType.Jewel: if (notgift) { if (bDouble) { _DataPlayer.Jewel += szAllReward[i][1]; jewel += szAllReward[i][1]; _DataPlayer.Jewel += szAllReward[i][1]; jewel += szAllReward[i][1]; } } else { _DataPlayer.Jewel += szAllReward[i][1]; jewel += szAllReward[i][1]; if (bDouble) { _DataPlayer.Jewel += szAllReward[i][1]; jewel += szAllReward[i][1]; } } break; } } if (jewel > 0) { if (mRType == YHRewardType.Levelup) //level up reward { //TDGAVirtualCurrency.OnReward(jewel,"LevelUp"); } } // Dictionary<string, object> dic = new Dictionary<string, object>(); // if(mRType != YHRewardType.Levelup && mRType != YHRewardType.Other) // { // dic.Add("result",WGStrings.getText(9002)); // TalkingDataGA.OnEvent(labTitle.text,dic); // } }