protected override void OnInstanceInit() { mCurScene = UnitySceneManager.GetActiveScene(); mFirstSceneLoaded = new SceneAssetPath(mCurScene); if (!_rootScene.isValid) { _rootScene = mFirstSceneLoaded; } //mIsFullscreen = Screen.fullScreen; mPauseCounter = 0; mTransitions = new List <ITransition>(); if (stackEnable) { mSceneStack = new Stack <string>(stackCapacity); } mScenesAdded = new List <Scene>(); mScenesToAdd = new Queue <string>(); mScenesToRemove = new Queue <Scene>(); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj is Scene) { Scene s = (Scene)obj; return(name == s.name && path == s.path); } else if (obj is SceneAssetPath) { SceneAssetPath s = (SceneAssetPath)obj; return(name == s.name && path == s.path); } return(base.Equals(obj)); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { EditorGUI.BeginProperty(position, label, property); position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label); var propName = property.FindPropertyRelative("name"); var propPath = property.FindPropertyRelative("path"); var scenes = EditorBuildSettings.scenes; var names = new string[scenes.Length + 1]; var paths = new string[scenes.Length + 1]; names[0] = "None"; paths[0] = ""; for (int i = 0; i < scenes.Length; i++) { names[i + 1] = SceneAssetPath.LoadableName(scenes[i].path); paths[i + 1] = scenes[i].path; } var ind = System.Array.IndexOf(paths, propPath.stringValue); if (ind == -1) { ind = 0; } var newInd = EditorGUI.Popup(position, ind, names); if (newInd != ind) { propName.stringValue = newInd > 0 ? names[newInd] : ""; propPath.stringValue = paths[newInd]; } EditorGUI.EndProperty(); }
void M8.IModalPush.Push(M8.GenericParams parms) { mActivateGOs.Clear(); var inf = parms.GetValue <VictoryInfo>(parmVictoryInfo); mNextScene = inf.toScene; int attackScore = Mathf.CeilToInt(inf.attackValue.fValue * GameData.instance.attackMultiplier); int defenseScore = Mathf.CeilToInt(inf.defenseValue.fValue * GameData.instance.defenseMultiplier); int roundsScore = Mathf.RoundToInt((GameData.instance.roundPar - inf.roundsCount) * GameData.instance.roundBonus); if (roundsScore < 0) { roundsScore = 0; } int finishScore = GameData.instance.victoryScore; int revivePenalty = Mathf.RoundToInt(inf.reviveCount * GameData.instance.revivePenality); mTotalScore = (attackScore + defenseScore + roundsScore + finishScore) - revivePenalty; if (mTotalScore < 0) { mTotalScore = 0; } //attack if ((inf.flags & VictoryStatFlags.Attack) != VictoryStatFlags.None) { if (attackRootGO) { attackRootGO.SetActive(true); } if (attackDisplayGO) { mActivateGOs.Add(attackDisplayGO); } if (attackValueDisplay) { attackValueDisplay.number = inf.attackValue.simplified; } if (attackScoreText) { attackScoreText.text = "+" + attackScore.ToString(); } } else { if (attackRootGO) { attackRootGO.SetActive(false); } } //defense if ((inf.flags & VictoryStatFlags.Defense) != VictoryStatFlags.None) { if (defenseRootGO) { defenseRootGO.SetActive(true); } if (defenseDisplayGO) { mActivateGOs.Add(defenseDisplayGO); } if (defenseValueDisplay) { defenseValueDisplay.number = inf.defenseValue.simplified; } if (defenseScoreText) { defenseScoreText.text = "+" + defenseScore.ToString(); } } else { if (defenseRootGO) { defenseRootGO.SetActive(false); } } //rounds if ((inf.flags & VictoryStatFlags.Rounds) != VictoryStatFlags.None) { if (roundsRootGO) { roundsRootGO.SetActive(true); } if (roundsDisplayGO) { mActivateGOs.Add(roundsDisplayGO); } if (roundsText) { roundsText.text = string.Format(roundsFormat, inf.roundsCount, GameData.instance.roundPar); } if (roundsScoreText) { roundsScoreText.text = "+" + roundsScore.ToString(); } } else { if (roundsRootGO) { roundsRootGO.SetActive(false); } } //finish if (finishDisplayGO) { mActivateGOs.Add(finishDisplayGO); } if (finishScoreText) { finishScoreText.text = "+" + finishScore.ToString(); } //revive if ((inf.flags & VictoryStatFlags.Revive) != VictoryStatFlags.None) { if (reviveRootGO) { reviveRootGO.SetActive(true); } if (reviveDisplayGO) { mActivateGOs.Add(reviveDisplayGO); } if (reviveCountText) { reviveCountText.text = inf.reviveCount.ToString(); } if (reviveScoreText) { reviveScoreText.text = (-revivePenalty).ToString(); } } else { if (reviveRootGO) { reviveRootGO.SetActive(false); } } //total if (totalDisplayGO) { mActivateGOs.Add(totalDisplayGO); } for (int i = 0; i < mActivateGOs.Count; i++) { mActivateGOs[i].SetActive(false); } totalScoreCounter.SetCountImmediate(0); mIsActivateShown = false; }
void M8.IModalPush.Push(M8.GenericParams parms) { scoreGO.SetActive(false); bonusRoundScoreGO.SetActive(false); timeGO.SetActive(false); timeBonusGO.SetActive(false); perfectBonusGO.SetActive(false); separatorGO.SetActive(false); totalGO.SetActive(false); if (rankingGO) { rankingGO.SetActive(false); } mLevelIndex = -1; mScore = 0; mBonusRoundScore = 0; mTime = float.MaxValue; mTimeScore = 0; mRoundsCount = 0; mPerfectScore = 0; mMistakeCount = 0; if (parms != null) { if (parms.ContainsKey(parmLevel)) { mLevelIndex = parms.GetValue <int>(parmLevel); } if (parms.ContainsKey(parmBonusRoundScore)) { mBonusRoundScore = parms.GetValue <int>(parmBonusRoundScore); } if (parms.ContainsKey(parmScore)) { mScore = parms.GetValue <int>(parmScore); } if (parms.ContainsKey(parmTime)) { mTime = parms.GetValue <float>(parmTime); } if (parms.ContainsKey(parmRoundsCount)) { mRoundsCount = parms.GetValue <int>(parmRoundsCount); } if (parms.ContainsKey(parmMistakeCount)) { mMistakeCount = parms.GetValue <int>(parmMistakeCount); } if (parms.ContainsKey(parmNextScene)) { mNextScene = parms.GetValue <M8.SceneAssetPath>(parmNextScene); } } //apply scores if (mRoundsCount > 0) { float timePar = GameData.instance.timeParPerRound * mRoundsCount; if (mTime < timePar) { mTimeScore = Mathf.RoundToInt(GameData.instance.timeBonus * (timePar - mTime)); } } if (mMistakeCount == 0) { mPerfectScore = GameData.instance.perfectPoints; } mTotalScore = mScore + mBonusRoundScore + mTimeScore + mPerfectScore; if (rankWidget) { rankWidget.Apply(mRoundsCount, mTotalScore); } M8.SoundPlaylist.instance.Play(soundEnter, false); }