public GameObject Spawn(string templateName, Vector2 position, float rotate, M8.GenericParams parms) { GameObject spawnGO = null; TemplateInfo template = null; for (int i = 0; i < templates.Length; i++) { if (templates[i].name == templateName) { template = templates[i]; break; } } if (template != null) { mSpawnParms.Clear(); mSpawnParms[JellySpriteSpawnController.parmPosition] = position; mSpawnParms[JellySpriteSpawnController.parmRotation] = rotate; mSpawnParms.Merge(parms, true); var spawn = mPool.Spawn(templateName, templateName, null, mSpawnParms); spawnGO = spawn.gameObject; } else { Debug.LogWarning("Template does not exists: " + templateName); } return(spawnGO); }
void OnBlobDragBegin(Blob blob) { if (!mCurConnectDragging) { mConnectSpawnParms.Clear(); //params? mCurConnectDragging = mPool.Spawn <BlobConnect>(connectTemplate.name, "", null, mConnectSpawnParms); } curBlobDragging = blob; var toOp = mCurOp; //determine what the operator is based on blob's current connect state mCurConnectDragging.op = toOp; mCurConnectDragging.state = BlobConnect.State.Connecting; if (mCurConnectDragging.connectingSpriteRender) { mCurConnectDragging.connectingSpriteRender.color = curBlobDragging.color; } //determine if this is in a group curGroupDragging = GetGroup(blob); if (curGroupDragging != null) { //highlight entire group //flip operand order based if it's the first operand if (blob == curGroupDragging.blobOpLeft) { curGroupDragging.blobOpLeft = curGroupDragging.blobOpRight; curGroupDragging.blobOpRight = blob; } } }
public void Show(M8.GenericParams parmCache) { parmCache.Clear(); parmCache[ModalDialogBase.parmPauseOverride] = pause; switch (type) { case Type.TextOnly: parmCache[ModalDialog.parmStringRefs] = stringRefs; break; case Type.TextAndImage: parmCache[ModalDialogImage.parmPairRefs] = stringAndImageRefs; break; case Type.TextAndComposite: parmCache[ModalDialogComposite.parmPairRefs] = stringAndCompositeRefs; break; } M8.UIModal.Manager.instance.ModalOpen(modal, parmCache); }
IEnumerator DoActive() { var parms = new M8.GenericParams(); //upgrade dialog UpgradeType upgrade = UpgradeType.None; ModalUpgrade.UpgradeChosenCallback cb = delegate(UpgradeType toUpgrade) { upgrade = toUpgrade; }; parms[ModalUpgrade.parmCallback] = cb; M8.UIModal.Manager.instance.ModalOpen(modalUpgrade, parms); while (upgrade == UpgradeType.None) { yield return(null); } parms.Clear(); // //dialog to say there's a quiz bool isDlgClosed = false; System.Action dialogCb = delegate() { isDlgClosed = true; }; parms[ModalDialog.parmStringRefs] = new string[] { dialogPreQuiz }; parms[ModalDialogBase.parmPauseOverride] = true; parms[ModalDialogBase.parmActionFinish] = dialogCb; M8.UIModal.Manager.instance.ModalOpen(modalDialog, parms); while (!isDlgClosed) { yield return(null); } parms.Clear(); // //quiz time isDlgClosed = false; bool isAnsweredCorrectly = false; ModalLoLQuestion.ResultCallback quizResultCb = delegate(bool correct) { isDlgClosed = true; isAnsweredCorrectly = correct; }; parms[ModalLoLQuestion.parmResultCallback] = quizResultCb; M8.UIModal.Manager.instance.ModalOpen(modalQuiz, parms); while (!isDlgClosed) { yield return(null); } parms.Clear(); //fail-safe if we needed more questions if (LoLManager.instance.isQuestionsAllAnswered) { LoLManager.instance.ResetCurrentQuestionIndex(); } // //upgrade? if (isAnsweredCorrectly) { MissionController.instance.Upgrade(upgrade); mRout = null; state = (int)EntityState.Alert; } else { //wrong :( isDlgClosed = false; parms[ModalDialog.parmStringRefs] = new string[] { dialogPostQuizFail }; parms[ModalDialogBase.parmPauseOverride] = true; parms[ModalDialogBase.parmActionFinish] = dialogCb; M8.UIModal.Manager.instance.ModalOpen(modalDialog, parms); while (!isDlgClosed) { yield return(null); } parms.Clear(); // mRout = null; state = (int)EntityState.Sleep; } }
IEnumerator DoActions(MissionController missionCtrl, Action[] actions) { for (int i = 0; i < actions.Length; i++) { var act = actions[i]; bool isError = false; M8.Animator.AnimatorData anim; mParmsDialog.Clear(); switch (act.type) { case ActionType.AnimPlay: if (mAnimatorLookups.TryGetValue(act.lookup, out anim) && anim) { anim.Play(act.id); } else { isError = true; } break; case ActionType.AnimPlayAndWait: if (mAnimatorLookups.TryGetValue(act.lookup, out anim) && anim) { anim.Play(act.id); while (anim.isPlaying) { yield return(null); } } else { isError = true; } break; case ActionType.Dialog: mParmsDialog[ModalDialog.parmStringRefs] = new string[] { act.stringRef }; M8.UIModal.Manager.instance.ModalOpen(act.id, mParmsDialog); while (M8.UIModal.Manager.instance.ModalIsInStack(act.id) || M8.UIModal.Manager.instance.isBusy) { yield return(null); } break; case ActionType.DialogImage: mParmsDialog[ModalDialogImage.parmPairRefs] = new ModalDialogImage.PairRef[] { new ModalDialogImage.PairRef() { stringRef = act.stringRef, sprite = act.sprite } }; M8.UIModal.Manager.instance.ModalOpen(act.id, mParmsDialog); while (M8.UIModal.Manager.instance.ModalIsInStack(act.id) || M8.UIModal.Manager.instance.isBusy) { yield return(null); } break; case ActionType.DialogComposite: mParmsDialog[ModalDialogComposite.parmPairRefs] = new ModalDialogComposite.PairRef[] { new ModalDialogComposite.PairRef() { stringRef = act.stringRef, compositeName = act.lookup } }; M8.UIModal.Manager.instance.ModalOpen(act.id, mParmsDialog); while (M8.UIModal.Manager.instance.ModalIsInStack(act.id) || M8.UIModal.Manager.instance.isBusy) { yield return(null); } break; case ActionType.SelectArea: mParmsDialog[ModalSelect.parmIndex] = act.iVal; M8.UIModal.Manager.instance.ModalOpen(modalSelect, mParmsDialog); while (M8.UIModal.Manager.instance.ModalIsInStack(modalSelect) || M8.UIModal.Manager.instance.isBusy) { yield return(null); } break; case ActionType.InputLock: missionCtrl.inputLock = true; break; case ActionType.InputUnlock: missionCtrl.inputLock = false; break; case ActionType.TimeLock: missionCtrl.isStageTimePause = true; break; case ActionType.TimeUnlock: missionCtrl.isStageTimePause = false; break; case ActionType.WaitEnemyCount: do { yield return(null); } while(missionCtrl.enemyCount > 0); break; case ActionType.Wait: yield return(new WaitForSeconds(act.fVal)); break; case ActionType.QuestionBonusDuration: case ActionType.QuestionBonusUpgradeMucus: case ActionType.QuestionBonusEnemyWipe: yield return(DoQuestion(act)); break; case ActionType.UpgradeReady: missionCtrl.UpgradeReady(); break; } if (isError) { Debug.LogWarning(string.Format("Error for id = {0}, lookup = {1}", act.id, act.lookup)); } } }
IEnumerator Start() { //intro input.isLocked = true; animator.Play(takeStart); while (animator.isPlaying) { yield return(null); } var parmDlg = new M8.GenericParams(); //start dialog for (int i = 0; i < dialogsBegin.Length; i++) { dialogsBegin[i].Show(parmDlg); while (dialogsBegin[i].isShowing) { yield return(null); } } parmDlg.Clear(); // //prepare animation animator.Play(takePrepare); while (animator.isPlaying) { yield return(null); } //init play GenerateQuestions(); mCurScore = 0; HUD.instance.SetMissionActive(true); HUD.instance.SetTimeActive(false); HUD.instance.UpdateScore(mCurScore, mCurScore); //play while (mCurQuestionIndex < mQuestions.Length) { mIncorrectCounter = 0; var question = curQuestion; //deck entry animator.Play(takeDeckEnter); while (animator.isPlaying) { yield return(null); } //populate deck PopulateDeck(); //dock SetupDock(); //question dialog parmDlg[ModalDialog.parmStringRefs] = new string[] { curQuestion.questionStringRef }; parmDlg[ModalDialog.parmPauseOverride] = false; M8.UIModal.Manager.instance.ModalOpen(modalQuestion, parmDlg); parmDlg.Clear(); // input.isLocked = false; //wait for anchors to be filled while (mAvailableAnchors.Count > 0) { yield return(null); if (mIsAnswerPicked) { input.isLocked = true; yield return(null); yield return(null); mIsAnswerPicked = false; input.isLocked = false; } } input.isLocked = true; M8.UIModal.Manager.instance.ModalCloseUpTo(modalQuestion, true); //deck exit ClearDeck(); animator.Play(takeDeckExit); while (animator.isPlaying) { yield return(null); } bool isResultEnterPlayed = false; //results dialog if (!string.IsNullOrEmpty(curQuestion.resultStringRef)) { //move to an appropriate position animator.Play(takeQuestionResultEnter); isResultEnterPlayed = true; parmDlg[ModalDialog.parmStringRefs] = new string[] { curQuestion.resultStringRef }; parmDlg[ModalDialog.parmPauseOverride] = false; M8.UIModal.Manager.instance.ModalOpen(modalPostQuestion, parmDlg); while (M8.UIModal.Manager.instance.isBusy || M8.UIModal.Manager.instance.ModalIsInStack(modalPostQuestion)) { yield return(null); } parmDlg.Clear(); } else { yield return(new WaitForSeconds(1f)); } // ClearDock(); //next mCurQuestionIndex++; //show multi question dialog explanation if (mCurQuestionIndex == mQuestionMultiStartIndex) { dialogMultiQuestionBegin.Show(parmDlg); while (dialogMultiQuestionBegin.isShowing) { yield return(null); } parmDlg.Clear(); } //move back if (isResultEnterPlayed) { //in case dialog was ended quickly while (animator.isPlaying) { yield return(null); } animator.Play(takeQuestionResultExit); while (animator.isPlaying) { yield return(null); } } yield return(null); } ClearDock(); //end input.isLocked = true; StartCoroutine(DoVictoryMusic()); animator.Play(takeEndPrepare); while (animator.isPlaying) { yield return(null); } //end dialog for (int i = 0; i < dialogsEnd.Length; i++) { dialogsEnd[i].Show(parmDlg); while (dialogsEnd[i].isShowing) { yield return(null); } } parmDlg.Clear(); // animator.Play(takeEnd); if (takeEndWait) { while (animator.isPlaying) { if (Input.anyKeyDown) { animator.GotoFrame(takeEndSkipFrame); break; } yield return(null); } } parmDlg[ModalStartFinish.parmMaxScore] = mMaxScore; M8.UIModal.Manager.instance.ModalOpen(modalProceed, parmDlg); }