public override void CloseGameBootFace() { if (asyncLoad != null) { asyncLoad = null; } progressBar.SetProgressBar(1.0f, true); base.CloseGameBootFace(); }
public override void OnUpdate() { base.OnUpdate(); EnterStart(); if (LoadObject != null) { //计算本周期进度条增加量 float accelerateValue = Mathf.Max(InputDevice.Accelerate((int)IParkourPlayer_Xiong.PlayerIndex.Index_P1), InputDevice.Accelerate((int)IParkourPlayer_Xiong.PlayerIndex.Index_P2)); if (accelerateValue > 0.0f) { loadAnimation.wrapMode = WrapMode.Loop; loadAnimation.CrossFade("X_PlayerSprint"); } else { loadAnimation.wrapMode = WrapMode.Loop; loadAnimation.CrossFade("X_PlayerRun"); } float processAddValue = TimeProgressAdd + Mathf.Lerp(0.0f, AccelerateProgressAdd, accelerateValue); //计算出来的是每秒的增加量,需要折算到当前周期 currentProgressValue += Mathf.Lerp(0.0f, processAddValue, Time.deltaTime); progressBar.SetProgressBar(currentProgressValue); //更新坐标 Vector3 p = loadAnimation.transform.localPosition; p.x = Mathf.Lerp(leftposition.localPosition.x, rightposition.localPosition.x, currentProgressValue); loadAnimation.transform.localPosition = p; //多算一些 if (currentProgressValue >= 1.1f) { ShowGameStart(); return; } currentRemainderTime -= Time.deltaTime; if (currentRemainderTime >= 0.0f) { UpdateTime(); } } }
private void UpdateCurrentSelectMapData(int index) { //获取最后解锁的地图 int lastLockMapIndex = IGamerProfile.Instance.getLastLockedMap; //这个地图是锁定的 if (lastLockMapIndex < index) { processObject.SetActive(false); lockObject.SetActive(true); } else { lockObject.SetActive(false); processObject.SetActive(true); //刷新数据 curLevelNumber.Text = IGamerProfile.Instance.playerdata.levelProcess[index].ToString(); maxLevelNumber.Text = IGamerProfile.gameLevel.mapMaxLevel[index].ToString(); levelProgressBar.SetProgressBar((float)IGamerProfile.Instance.playerdata.levelProcess[index] / (float)IGamerProfile.gameLevel.mapMaxLevel[index]); } for (int i = 0; i < selectPosition.Length; i++) { selectPosition[i].SetActive(false); } selectPosition[index].SetActive(true); if (index == 0) { arrowsright.SetActive(true); arrowsleft.SetActive(false); } else if (index == IGamerProfile.gameLevel.mapData.Length - 1) { arrowsright.SetActive(false); arrowsleft.SetActive(true); } else { arrowsright.SetActive(true); arrowsleft.SetActive(true); } buttonGroup.IsWorkDo = true; }
private void InitUI() { m_Background = GameRoot.uiOrthographicCamera.LoadLanguageResource_UIPrefabs("SelectMapBackground.prefab", GameRoot.gameResource); LoadObject = GameRoot.uiOrthographicCamera.LoadLanguageResource_UIPrefabs("SelecetMapLoadgame.prefab", GameRoot.gameResource); progressBar = GameObject.Find("/UICamera(Clone)/SelecetMapLoadgame(Clone)/bar").GetComponent <GuiPlaneAnimationProgressBar>(); loadAnimation = GameObject.Find("/UICamera(Clone)/SelecetMapLoadgame(Clone)/X_PlayerRun").GetComponent <Animation>(); leftposition = GameObject.Find("/UICamera(Clone)/SelecetMapLoadgame(Clone)/leftposition").GetComponent <Transform>(); rightposition = GameObject.Find("/UICamera(Clone)/SelecetMapLoadgame(Clone)/rightposition").GetComponent <Transform>(); //设置进度值 progressBar.SetProgressBar(currentProgressValue); //设置动画 loadAnimation.wrapMode = WrapMode.Loop; loadAnimation.CrossFade("X_PlayerRun"); SelectMap_Remainder = GameRoot.uiOrthographicCamera.LoadLanguageResource_UIPrefabs("SelectMap_Remainder.prefab", GameRoot.gameResource).GetComponent <GuiPlaneAnimationTextAdvanced>(); currentRemainderTime = RemainderTime; UpdateTime(); SoundEffectPlayer.Play("loadgame.wav"); }
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 UpdateCurrentSelectGunData(int index) { //角色没有解锁 if (!IGamerProfile.Instance.playerdata.characterData[index].isactive) { lockObject.SetActive(true); btn_levelcharacter.transform.parent.gameObject.SetActive(false); btn_activecharacter.transform.parent.gameObject.SetActive(true); //刷新激活角色的钱 activecharactermoney.Text = IGamerProfile.gameCharacter.characterDataList[index].activemoney.ToString(); //填充按钮 buttonGroup.buttonList = new GameObject[(int)ButtonId_NotActiveCharacter.ButtonCount]; buttonGroup.selectAnchorList = new GuiAnchorObject[(int)ButtonId_NotActiveCharacter.ButtonCount]; buttonGroup.buttonList[(int)ButtonId_NotActiveCharacter.Id_ActiveCharacter] = btn_activecharacter; buttonGroup.selectAnchorList[(int)ButtonId_NotActiveCharacter.Id_ActiveCharacter] = btn_activecharacter.GetComponent <GuiAnchorObject>(); buttonGroup.buttonList[(int)ButtonId_NotActiveCharacter.Id_IntoGame] = btn_intogame; buttonGroup.selectAnchorList[(int)ButtonId_NotActiveCharacter.Id_IntoGame] = btn_intogame.GetComponent <GuiAnchorObject>(); if ((selectCharacterMode == SelectCharacterMode.Mode_IntoGame) && (GameCenterEviroment.platformChargeIntensity >= GameCenterEviroment.PlatformChargeIntensity.Intensity_High) && isNotHandle) { //高收费,用户是进入游戏,而且用户没有自主动过操作 buttonGroup.CurrentSelectButtonIndex = (int)ButtonId_NotActiveCharacter.Id_IntoGame; } else if ((selectCharacterMode == SelectCharacterMode.Mode_NextGame) && (GameCenterEviroment.platformChargeIntensity >= GameCenterEviroment.PlatformChargeIntensity.Intensity_Normal) && isNotHandle) { //高收费,用户是进入游戏,而且用户没有自主动过操作 buttonGroup.CurrentSelectButtonIndex = (int)ButtonId_NotActiveCharacter.Id_IntoGame; } else { //任何时候都选择需要解锁角色 buttonGroup.CurrentSelectButtonIndex = (int)ButtonId_NotActiveCharacter.Id_ActiveCharacter; } } else if (IGamerProfile.Instance.playerdata.characterData[index].level >= IGamerProfile.gameCharacter.characterDataList[index].maxlevel) { //级别升满了 lockObject.SetActive(false); btn_levelcharacter.transform.parent.gameObject.SetActive(false); btn_activecharacter.transform.parent.gameObject.SetActive(false); //填充按钮 buttonGroup.buttonList = new GameObject[(int)ButtonId_MaxLevel.ButtonCount]; buttonGroup.selectAnchorList = new GuiAnchorObject[(int)ButtonId_MaxLevel.ButtonCount]; buttonGroup.buttonList[(int)ButtonId_MaxLevel.Id_IntoGame] = btn_intogame; buttonGroup.selectAnchorList[(int)ButtonId_MaxLevel.Id_IntoGame] = btn_intogame.GetComponent <GuiAnchorObject>(); //只需要选择进入游戏 buttonGroup.CurrentSelectButtonIndex = (int)ButtonId_MaxLevel.Id_IntoGame; } else { lockObject.SetActive(false); btn_levelcharacter.transform.parent.gameObject.SetActive(true); btn_activecharacter.transform.parent.gameObject.SetActive(false); //刷新升级角色的钱 levelcharactermoney.Text = IGamerProfile.gameCharacter.characterDataList[index].LevelToMoney.GetValue( IGamerProfile.Instance.playerdata.characterData[index].level).ToString(); //填充按钮 buttonGroup.buttonList = new GameObject[(int)ButtonId_ActiveCharacter.ButtonCount]; buttonGroup.selectAnchorList = new GuiAnchorObject[(int)ButtonId_ActiveCharacter.ButtonCount]; buttonGroup.buttonList[(int)ButtonId_ActiveCharacter.Id_LevelCharacter] = btn_levelcharacter; buttonGroup.selectAnchorList[(int)ButtonId_ActiveCharacter.Id_LevelCharacter] = btn_levelcharacter.GetComponent <GuiAnchorObject>(); buttonGroup.buttonList[(int)ButtonId_ActiveCharacter.Id_IntoGame] = btn_intogame; buttonGroup.selectAnchorList[(int)ButtonId_ActiveCharacter.Id_IntoGame] = btn_intogame.GetComponent <GuiAnchorObject>(); //设置选择哪个按钮 if (selectCharacterMode == SelectCharacterMode.Mode_IntoGame) { //保持原来的选择 buttonGroup.CurrentSelectButtonIndex = (int)ButtonId_ActiveCharacter.Id_IntoGame; } else if (selectCharacterMode == SelectCharacterMode.Mode_NextGame || selectCharacterMode == SelectCharacterMode.Mode_RebackGame) { if (IGameCenterEviroment.effectSelectCharacter) { buttonGroup.CurrentSelectButtonIndex = (int)ButtonId_ActiveCharacter.Id_LevelCharacter; } else if (!isNotHandle) { buttonGroup.CurrentSelectButtonIndex = (int)ButtonId_ActiveCharacter.Id_LevelCharacter; } else { buttonGroup.CurrentSelectButtonIndex = (int)ButtonId_ActiveCharacter.Id_IntoGame; } } } //刷新角色当前级别 curLevelNumber.Text = IGamerProfile.Instance.playerdata.characterData[index].level.ToString(); maxLevelNumber.Text = IGamerProfile.gameCharacter.characterDataList[index].maxlevel.ToString(); levelProgressBar.SetProgressBar((float)IGamerProfile.Instance.playerdata.characterData[index].level / (float)IGamerProfile.gameCharacter.characterDataList[index].maxlevel); //刷新角色当前级别的攻击力和命中率 characterAttack.SetIntegerRollValue(IGamerProfile.gameCharacter.characterDataList[index].LevelToAttack.GetValue( IGamerProfile.Instance.playerdata.characterData[index].level)); playerExact.SetIntegerRollValue(IGamerProfile.gameCharacter.characterDataList[index].LevelToExact.GetValue( IGamerProfile.Instance.playerdata.characterData[index].level)); for (int i = 0; i < selectPosition.Length; i++) { selectPosition[i].SetActive(false); } selectPosition[index].SetActive(true); if (index == 0) { arrowsright.SetActive(true); arrowsleft.SetActive(false); } else if (index == IGamerProfile.gameCharacter.characterDataList.Length - 1) { arrowsright.SetActive(false); arrowsleft.SetActive(true); } else { arrowsright.SetActive(true); arrowsleft.SetActive(true); } buttonGroup.IsWorkDo = true; }