private void OnDialogReback(int dialogid, GuiExtendDialog.DialogFlag ret) { switch (ret) { case GuiExtendDialog.DialogFlag.Flag_Cancel: { SoundEffectPlayer.Play("buttonok.wav"); UnityEngine.Object.DestroyObject(this.gameObject); GuiExtendButtonGroup buttonGroup = currentCallui.GetComponent <GuiExtendButtonGroup>(); if (buttonGroup != null) { buttonGroup.IsWorkDo = true; } //放弃充值,直接返回 currentPayMoneyData.callbackFun(currentPayMoneyData, false); } break; case GuiExtendDialog.DialogFlag.Flag_Ok: { SoundEffectPlayer.Play("buttonok.wav"); IGameCenterEviroment.currentGameCenterEviroment.OpenPlayerPayMoney(rechargeId, RechargePayCallback); } break; } }
//付费成功回调 private void RechargePayCallback(int payid, bool issucceed) { GuiExtendButtonGroup buttonGroup = currentCallui.GetComponent <GuiExtendButtonGroup>(); if (buttonGroup != null) { buttonGroup.IsWorkDo = true; } if (!issucceed) { //充值失败 //重新调整充值策略 IGamerProfile.Instance.AjustDefBuyItemId(payid); //删除对象 UnityEngine.Object.DestroyObject(this.gameObject); //回调充值失败 currentPayMoneyData.callbackFun(currentPayMoneyData, false); return; } //给用户加钱 IGamerProfile.Instance.playerdata.playerMoney += IGamerProfile.gameBaseDefine.jewelData.buyJewelList[rechargeId].jewel; IGamerProfile.Instance.SaveGamerProfileToServer(); //删除对象 UnityEngine.Object.DestroyObject(this.gameObject); //重新尝试付款 IGamerProfile.Instance.PayMoney(currentPayMoneyData, currentCallui); }
//进行一次收费 public void PayMoney(PayMoneyData paydata, GuiUiSceneBase callui) { //检测钱够不够 if (playerdata.playerMoney < paydata.money) { //激活收费框 GuiExtendButtonGroup buttonGroup = callui.GetComponent <GuiExtendButtonGroup>(); if (buttonGroup != null) { buttonGroup.IsWorkDo = false; } #if _GameType_BaoYue UiSceneNotEnoughMoney em = callui.LoadResource_UIPrefabs("notenougmoney.prefab").GetComponent <UiSceneNotEnoughMoney>(); em.Initialization(paydata, callui); #else UiSceneRechargeAsk recharge = callui.LoadResource_UIPrefabs("rechargeask.prefab").GetComponent <UiSceneRechargeAsk>(); recharge.Initialization(paydata, callui); #endif // _GameType_BaoYue return; } //扣除钱 playerdata.playerMoney -= paydata.money; //回调扣钱成功的函数 paydata.callbackFun(paydata, true); }
protected override void OnInitializationUI() { GuiExtendButtonGroup g = GetComponent <GuiExtendButtonGroup>(); g.selectFuntion += OnButtonSelectOk; //g.CurrentSelectButtonIndex = g.selectAnchorList.Length - 1; g.CurrentSelectButtonIndex = IGamerProfile.gameBaseDefine.platformChargeIntensityData.closeLevel_Treasure_BtnIndex; oneopenMoney.Text = IGamerProfile.gameBaseDefine.gameParameter.treasure.openonce.ToString(); allopenMoney.Text = IGamerProfile.gameBaseDefine.gameParameter.treasure.openall.ToString(); boxisopen = new bool[boxposition.Length]; for (int i = 0; i < boxisopen.Length; i++) { boxisopen[i] = false; } awardIcon = new GameObject[boxposition.Length]; for (int i = 0; i < awardIcon.Length; i++) { awardIcon[i] = null; } }
protected override void OnInitializationUI() { buttonGroup = GetComponent <GuiExtendButtonGroup>(); buttonGroup.selectFuntion += OnButtonSelectOk; //先停止工作 buttonGroup.IsWorkDo = false; //定位到最后解锁的地图上 SetCurrentSelectMapIndex(IGamerProfile.Instance.getLastLockedMap); }
protected override void OnInitializationUI() { playerMoney.SetIntegerRollValue(0, true); playerMoney.SetIntegerRollValue(IGamerProfile.Instance.playerdata.playerMoney); characterAttack.SetIntegerRollValue(0, true); playerExact.SetIntegerRollValue(0, true); buttonGroup = GetComponent <GuiExtendButtonGroup>(); buttonGroup.selectFuntion += OnButtonSelectOk; //先停止工作 buttonGroup.IsWorkDo = false; //进入游戏,定位到已经解锁的角色上 if (selectCharacterMode == SelectCharacterMode.Mode_IntoGame) { if ((GameCenterEviroment.platformChargeIntensity >= GameCenterEviroment.PlatformChargeIntensity.Intensity_High) && IGameCenterEviroment.effectSelectCharacter) { //定位到未解锁的角色上 int index = IGamerProfile.Instance.getFirstUnActiveCharacter; if (index != -1) { SetCurrentSelectGunIndex(index); } else { SetCurrentSelectGunIndex(IGamerProfile.Instance.getSelectCharacter); } } else { //定位到最后解锁的地图上 SetCurrentSelectGunIndex(IGamerProfile.Instance.getSelectCharacter); } } else if (selectCharacterMode == SelectCharacterMode.Mode_NextGame || selectCharacterMode == SelectCharacterMode.Mode_RebackGame) { if (IGameCenterEviroment.effectSelectCharacter) { int index = IGamerProfile.Instance.getFirstUnActiveCharacter; if (index != -1) { SetCurrentSelectGunIndex(index); } else { SetCurrentSelectGunIndex(IGamerProfile.Instance.getSelectCharacter); } } else { //定位到最后解锁的地图上 SetCurrentSelectGunIndex(IGamerProfile.Instance.getSelectCharacter); } } }
protected override void OnInitializationUI() { buttonGroup = GetComponent <GuiExtendButtonGroup>(); buttonGroup.selectFuntion += OnButtonSelectOk; //如果档案还没有准备好则隐藏选择光标 buttonGroup.IsWorkDo = false; //尝试激活手机控制二维码 InputDevice.Instance.OpenQRCodeCreator = true; }
protected override void OnInitializationUI() { buttonGroup = GetComponent <GuiExtendButtonGroup>(); buttonGroup.selectFuntion += OnButtonSelectOk; buttonGroup.onDialogCloseFuntion += OnDialogClose; if (result == Result.Result_Win) { winTitle.SetActive(true); faileTitle.SetActive(false); winAward.SetActive(true); faileAward.SetActive(false); btn_nextlevel.SetActive(true); btn_restart.SetActive(false); int money = IGamerProfile.gameLevel.mapData[IGamerProfile.Instance.gameEviroment.mapIndex]. levelData[IGamerProfile.Instance.gameEviroment.mapLevelIndex].winawardmoney; IGamerProfile.Instance.playerdata.playerMoney += money; awardMoney.Text = money.ToString(); } else if (result == Result.Result_Faile) { winTitle.SetActive(false); faileTitle.SetActive(true); winAward.SetActive(false); faileAward.SetActive(true); btn_nextlevel.SetActive(false); btn_restart.SetActive(true); int money = IGamerProfile.gameLevel.mapData[IGamerProfile.Instance.gameEviroment.mapIndex]. levelData[IGamerProfile.Instance.gameEviroment.mapLevelIndex].failawardmoney; IGamerProfile.Instance.playerdata.playerMoney += money; awardMoney.Text = money.ToString(); } //关卡数 levelnumber.Text = string.Format("{0}", IGamerProfile.Instance.playerdata.AccountLevelTotal(IGamerProfile.Instance.gameEviroment.mapIndex)); //发生数 firenumber.Text = IGamerProfile.Instance.gameEviroment.fireCount.ToString(); //杀敌数 killerumber.Text = IGamerProfile.Instance.gameEviroment.killCount.ToString(); //命中率 float hitrate = (float)IGamerProfile.Instance.gameEviroment.killCount / (float)IGamerProfile.Instance.gameEviroment.fireCount; hitratioumber.Text = string.Format("{0}", (int)(hitrate * 100f)); //使用时间 float useTime = (float)IGamerProfile.gameLevel.mapData[IGamerProfile.Instance.gameEviroment.mapIndex]. levelData[IGamerProfile.Instance.gameEviroment.mapLevelIndex].time - IGamerProfile.Instance.gameEviroment.useTime; //计算有多少分钟 int minute = (int)useTime / 60; //剩余多少秒 float remainsecond = useTime - (float)(minute * 60); timeminute.Text = minute.ToString(); timesecond.Text = string.Format("{0}", (int)remainsecond); //更新进度 IGamerProfile.Instance.playerdata.levelProcess[IGamerProfile.Instance.gameEviroment.mapIndex] += 1; if (IGamerProfile.Instance.playerdata.levelProcess[IGamerProfile.Instance.gameEviroment.mapIndex] > IGamerProfile.gameLevel.mapMaxLevel[IGamerProfile.Instance.gameEviroment.mapIndex]) { IGamerProfile.Instance.playerdata.levelProcess[IGamerProfile.Instance.gameEviroment.mapIndex] = IGamerProfile.gameLevel.mapMaxLevel[IGamerProfile.Instance.gameEviroment.mapIndex]; } IGamerProfile.Instance.SaveGamerProfileToServer(); levelProcess_Cur.Text = IGamerProfile.Instance.playerdata.levelProcess[IGamerProfile.Instance.gameEviroment.mapIndex].ToString(); levelProcess_Max.Text = IGamerProfile.gameLevel.mapMaxLevel[IGamerProfile.Instance.gameEviroment.mapIndex].ToString(); levelprogressbar.SetProgressBar((float)IGamerProfile.Instance.playerdata.levelProcess[IGamerProfile.Instance.gameEviroment.mapIndex] / (float)IGamerProfile.gameLevel.mapMaxLevel[IGamerProfile.Instance.gameEviroment.mapIndex]); if ((IGamerProfile.Instance.gameEviroment.mapIndex < IGamerProfile.gameLevel.mapData.Length - 1) && (IGamerProfile.Instance.playerdata.levelProcess[IGamerProfile.Instance.gameEviroment.mapIndex] == IGamerProfile.gameLevel.mapMaxLevel[IGamerProfile.Instance.gameEviroment.mapIndex])) { newMap.SetActive(true); } else { newMap.SetActive(false); } gunProcess_Cur.Text = IGamerProfile.Instance.playerdata.characterData[IGamerProfile.Instance.gameEviroment.characterIndex].level.ToString(); gunProcess_Max.Text = IGamerProfile.gameCharacter.characterDataList[IGamerProfile.Instance.gameEviroment.characterIndex].maxlevel.ToString(); gunprogressbar.SetProgressBar((float)IGamerProfile.Instance.playerdata.characterData[IGamerProfile.Instance.gameEviroment.characterIndex].level / (float)IGamerProfile.gameCharacter.characterDataList[IGamerProfile.Instance.gameEviroment.characterIndex].maxlevel); }
private void PayMoneyCallback(IGamerProfile.PayMoneyData paydata, bool isSucceed) { switch (paydata.item) { case IGamerProfile.PayMoneyItem.PayMoneyItem_OneTreasure: { if (!isSucceed) { //就选择到第一个去 GuiExtendButtonGroup g = GetComponent <GuiExtendButtonGroup>(); g.CurrentSelectButtonIndex = (int)ButtonId.Id_Cancel; return; } int index = -1; for (int i = 0; i < boxisopen.Length; i++) { if (!boxisopen[i]) { index = i; } } if (index == -1) { return; } boxisopen[index] = true; GameObject obj = LoadResource_UIPrefabs("OpenBoxEffect.prefab"); obj.transform.localPosition = boxposition[index].transform.localPosition; GuiPlaneAnimationPlayer pl = obj.GetComponent <GuiPlaneAnimationPlayer>(); OpenBoxData data = new OpenBoxData(); data.parent = this; data.boxIndex = index; pl.DelegateOnPlayEndEvent = data.OnPlayEventEnd; } break; case IGamerProfile.PayMoneyItem.PayMoneyItem_AllTreasure: { if (!isSucceed) { //就选择到第一个去 GuiExtendButtonGroup g = GetComponent <GuiExtendButtonGroup>(); g.CurrentSelectButtonIndex = (int)ButtonId.Id_Cancel; return; } //标记为全开 for (int i = 0; i < boxisopen.Length; i++) { boxisopen[i] = true; } //先播放光效 GameObject obj = null; for (int i = 0; i < boxposition.Length; i++) { obj = LoadResource_UIPrefabs("OpenBoxEffect.prefab"); obj.transform.localPosition = boxposition[i].transform.localPosition; } if (obj != null) { GuiPlaneAnimationPlayer pl = obj.GetComponent <GuiPlaneAnimationPlayer>(); pl.DelegateOnPlayEndEvent = OnEventOpenAllBoxEffectPlayEnd; } } break; } }