public void EnqueueDialog(DialogBase db, TaskGiver giver = null) { if (inDialog) { return; } buffer = true; inDialog = true; PlayerStatus.Instance.IsForzen = true; GameManager.Instance.playerGO.GetComponent <Rigidbody2D>().velocity = Vector2.zero; //读取说话人并触发说话事件 if (giver != null) { tg = giver; tg.OnTalkBegin(); } //缓冲器 StartCoroutine(BufferTimer()); //判断是否携带选项 OptionsParser(db); //展现对话panel UIMgr.Instance.ShowPanel <BasePanel>("DialogPanel", E_UI_Layer.top, (obj) => { dialogBox = obj.GetComponent <DialogPanel>(); }); //清空队列并逐句读取 dialogInfo.Clear(); foreach (DialogBase.Info info in db.dialogInfo) { dialogInfo.Enqueue(info); } //读取完成后输出第一行 Invoke("DequeueDialog", 0.1f); }
void Modify() { if (m_pwd == "") { DialogBase.Show("Modify Password", "Invalid password(NULL)."); return; } if (m_npwd != m_npwd2) { DialogBase.Show("Modify Password", "Your new and confirm passwords\n are different, Please retry."); return; } if (m_npwd == "") { DialogBase.Show("Modify Password", "Invalid new password(NULL)."); return; } m_pwdMD5 = Tools.GetMD5(m_pwd); m_npwdMD5 = Tools.GetMD5(m_npwd); Reception recp = GameObject.Find("Reception").GetComponent <Reception>(); recp.ModifyPassword(m_pwdMD5, m_npwdMD5, AfterModifyPassword); }
public async Task Issue(IDialogContext context, LuisResult result) { if (result.Entities.Count == 0) { DialogBase.PromptPaymentMode(context, this.ResumeAfterCardIssue); } else { CheckCardDialog checkDialog = new CheckCardDialog(); if (result.IsAbroad()) { await context.PostAsync("Pas encore implementée"); } else if (result.IsIssueDomesticWithDrawal()) //j'ai un problème de retrait domestique { checkDialog.MakeCheckCardFormDialog(DialogBase.PromptHowMuchMoney); } else if (CheckStatus.IsIssueTypeWithdrawal(result)) //J'ai un problème de retrait { checkDialog.MakeCheckCardFormDialog(DialogBase.PromptDomesticOrAbroad); } else if (CheckStatus.IsPayModeCard(result)) //J'ai un problème { checkDialog.MakeCheckCardFormDialog(DialogBase.PromptWithdrawalOrPayment); } context.Call(checkDialog, ResumeAfterCardIssue); } }
public void ReqSpin() { if (!m_clerk.Login) { DebugConsole.Log("!Login, cant reqspin"); // Show dialog here DialogBase.Show("MESSAGE", "!Login, cant reqspin"); return; } TigerReq tigerReq = new TigerReq(); tigerReq.BetGold = m_clerk.Bet; // only 10, 20, 30 // SeqNo 当前用来对应消息ID m_clerk.SeqNo = m_clerk.SpinCount; tigerReq.SeqNo = m_clerk.SpinCount; m_clerk.Begin(); // 开始计时 tigerReq.TigerNo = m_clerk.TigerNo; for (int i = 0; i < m_clerk.Lines; ++i) { tigerReq.Lines.Add(i); } m_net.SendEnqueue(Constants.Tiger_Spin, 0, tigerReq); }
public virtual bool ChooseFolder(string title, string initialFolder, out string folder) { bool ret; using (FileChooserDialog fc = new FileChooserDialog(title, null, FileChooserAction.SelectFolder, Translator.GetString("OK"), ResponseType.Accept, Translator.GetString("Cancel"), ResponseType.Cancel)) { DialogBase.PushModalDialog(fc, "ChooseOutputFolder"); if (!string.IsNullOrEmpty(initialFolder) && Directory.Exists(initialFolder)) { fc.SetCurrentFolder(initialFolder); } if (fc.Run() == (int)ResponseType.Accept) { folder = fc.CurrentFolder; ret = true; } else { folder = null; ret = false; } fc.Destroy(); DialogBase.PopModalDialog(fc, "ChooseOutputFolder"); } return(ret); }
static public void DoBuy(string buykey) { if (Application.platform == RuntimePlatform.Android) { AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); if (jc == null) { DialogBase.Show("ANDROID", "js is null"); return; } AndroidJavaObject jo = jc.GetStatic <AndroidJavaObject>("currentActivity"); if (jo == null) { DialogBase.Show("ANDROID", "jo is null"); return; } try { //string uuid = jo.CallStatic<string>("GetUUID"); jo.Call("Pay", buykey); } catch (System.Exception e) { DialogBase.Show("ANDROID", e.Message); } } }
public DialogForm(DialogBase content, DialogButtons buttons) : this(content) { bool btnOK = (buttons & DialogButtons.Ok) == DialogButtons.Ok; bool btnCancel = (buttons & DialogButtons.Cancel) == DialogButtons.Cancel; bool btnApply = (buttons & DialogButtons.Apply) == DialogButtons.Apply; if(!btnApply) { if(!btnCancel) { _btnOK.Left = _btnApply.Left; } else { _btnOK.Left = _btnCancel.Left; _btnCancel.Left = _btnApply.Left; } } else { if(!btnCancel) { _btnOK.Left = _btnCancel.Left; } } _btnOK.Visible = btnOK; _btnCancel.Visible = btnCancel; _btnApply.Visible = btnApply; }
private void StartChallengeProcess() { if (this.m_challengeDialog != null) { this.m_challengeDialog.Hide(); this.m_challengeDialog = null; } GameMgr.Get().SetPendingAutoConcede(true); if (this.IsChallengeTavernBrawl() && !TavernBrawlManager.Get().SelectHeroBeforeMission()) { if (TavernBrawlManager.Get().CurrentMission().canCreateDeck) { if (!TavernBrawlManager.Get().HasValidDeck()) { Debug.LogError("Attempting to start a Tavern Brawl challenge without a valid deck! How did this happen?"); return; } this.SelectDeck(TavernBrawlManager.Get().CurrentDeck().ID); } else { this.SkipDeckSelection(); } FriendlyChallengeHelper.Get().WaitForFriendChallengeToStart(); } else { Navigation.Clear(); SceneMgr.Get().SetNextMode(SceneMgr.Mode.FRIENDLY); } }
private string GetUUID() { if (Application.platform == RuntimePlatform.Android) { AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); if (jc == null) { DialogBase.Show("ANDROID", "js is null"); return(""); } AndroidJavaObject jo = jc.GetStatic <AndroidJavaObject>("currentActivity"); if (jo == null) { DialogBase.Show("ANDROID", "jo is null"); return(""); } try { string uuid = jo.Call <string>("GetUID"); return(uuid); } catch (System.Exception e) { DialogBase.Show("ANDROID", e.Message); } } return(""); }
/// <summary> /// ダイアログを表示する /// </summary> public IEnumerator DialogShow(DialogSelector.DialogType type, DialogData data = null) { DialogBase dialog = dialogSelector.GetDialog(type); Debug.Log("ダイアログ = " + dialog); if (dialog != null) { //ダイアログがひとつも表示されていなければ背景を表示する if (showDialogList.Count == 0) { backgroundObject.SetActive(true); } //対象ダイアログを生成 DialogBase targetDialog = DialogBase.Instantiate <DialogBase>(dialog); targetDialog.transform.SetParent(contentArea.transform, false); showDialogList.Add(targetDialog); //ダイアログ表示開始 yield return(targetDialog.Show(data)); //表示が終わったらダイアログを破棄 showDialogList.Remove(targetDialog); Destroy(targetDialog.gameObject); if (showDialogList.Count == 0) { backgroundObject.SetActive(false); } } }
void Register() { if (m_email == "") { DialogBase.Show("REGISTER EMAIL", "INVALID EMAIL(NULL)."); return; } string expression = @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)" + @"|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"; if (!System.Text.RegularExpressions.Regex.IsMatch(m_email, expression)) { DialogBase.Show("REGISTER EMAIL", "INVALID EMAIL ADDRESS."); return; } if (m_pwd != m_pwd2) { DialogBase.Show("REGISTER EMAIL", "YOUR NEW AND CONFIRM PASSWORDS\n ARE DIFFERENT, PLEASE RETRY."); return; } if (m_pwd == "") { DialogBase.Show("REGISTER EMAIL", "INVALID PASSWORD(NULL)."); return; } m_pwdMD5 = Tools.GetMD5(m_pwd); Reception recp = GameObject.Find("Reception").GetComponent <Reception>(); recp.RegisterByEmail(m_email, m_pwdMD5, AfterRegisterByEmail); }
void OnButtonSpin() { if (m_clerk.Spinning) { DebugConsole.Log("I'm spinning!"); DialogBase.Show("MESSAGE", "I'm spinning!SpinSeqNo:" + m_clerk.SeqNo); return; } else { m_clerk.SpinCount++; m_spinCheck = m_clerk.SpinCount; m_clerk.Spinning = true; } if (m_clerk.Win > 0) // 有奖励没有领取 { DebugConsole.Log("Error!"); // 当前是自动领取 DialogBase.Show("MESSAGE", "有奖励没有领取"); m_clerk.Displays.ShowJumpWin(); // 点击领取 } else { m_clerk.Requests.ReqSpin(); } }
public override bool IsAllowSceneBack() { //初回起動時に表示されるプロフィール画面ではバックボタンを使えないようにする if (DialogBase.IsDisp()) { //ダイアログ表示中であれば、戻れない return(false); } else { //1.初期起動時、スプラッシュから遷移してきた場合 if (UserDataManager.State.isInitialLunch()) { return(false); } //2.メニューの設定から遷移してきた場合 else { //戻るボタンを押したとき if (IsSettingAllItem()) { //すべての項目が設定されていれば return(true); } else { //設定されてない項目がある場合ダイアログを表示する StartCoroutine(TellExistUnSetItem()); return(false); } } } }
public override void ShowPane() { int y = 0; BookmarksOptionsPane lastPane = null; foreach (OptionsPaneCreator creator in _creators) { BookmarksOptionsPane pane = (BookmarksOptionsPane)creator(); pane.IsStartupPane = IsStartupPane; pane.ShowPane(); pane.Top = y; y += pane.OccupiedHeight; pane.Height = pane.OccupiedHeight; pane.Width = Width; Controls.Add(pane); _panes.Add(pane); pane.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right; lastPane = pane; } if (lastPane != null) { lastPane.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom; lastPane.Height = Height - (y - lastPane.Height); } DialogBase.AdjustContolProperties(this); }
public void Init(DialogBase d) { dq.Clear(); if (inDialog) { return; } inDialog = true; isOptionsType = (d is DialogOptions); if (isOptionsType) { DialogOptions options = d as DialogOptions; /* * for(var i=0; i<OptionButtons.Length; i++) { * OptionButtons[i].SetActive(true); * OptionButtons[i].transform.GetChild(0).gameObject.GetComponent<DText>().text = DialogOptions.OptionArray[i].optionText; * var eh = OptionButtons[i].GetComponent<UnityEventHandler>(); * eh.eventHandler = DialogOptions.OptionsArray[i].Activated; * } */ } DialogPanel.SetActive(true); foreach (DialogBase.DFrame i in d.DialogData) { dq.Enqueue(i); } Send(); }
private bool OnGameplayDialogProcessed(DialogBase dialog, object userData) { this.m_dialog = (AlertPopup)dialog; SceneMgr.Mode mode = (SceneMgr.Mode)((int)userData); SceneMgr.Get().SetNextMode(mode); SceneMgr.Get().RegisterSceneLoadedEvent(new SceneMgr.SceneLoadedCallback(this.OnSceneLoaded)); return(true); }
public void ShowNextDialog(DialogBase nextDB) { if (nextDB != null) { DialogMgr.Instance.EnqueueDialog(nextDB); } PlayerStatus.Instance.IsForzen = false; }
public static void Hide() { GameObject canvas = GameObject.Find("Canvas"); GameObject obj = canvas.transform.Find("DialogBase").gameObject; DialogBase dlg = obj.GetComponent <DialogBase>(); dlg.DoHide(obj); }
public static void Show(string title, string content, WorkDone cb = null) { GameObject canvas = GameObject.Find("Canvas"); GameObject obj = canvas.transform.Find("DialogBase").gameObject; DialogBase dlg = obj.GetComponent <DialogBase>(); dlg.DoShow(obj, title, content, cb); }
private void WillReset() { this.CleanUpChallengeData(false); if (this.m_challengeDialog != null) { this.m_challengeDialog.Hide(); this.m_challengeDialog = null; } }
private void ShowIReceivedChallengeDialog(BnetPlayer challenger) { if (this.m_challengeDialog != null) { this.m_challengeDialog.Hide(); this.m_challengeDialog = null; } DialogManager.Get().ShowFriendlyChallenge(challenger, this.IsChallengeTavernBrawl(), new FriendlyChallengeDialog.ResponseCallback(this.OnChallengeReceivedDialogResponse), new DialogManager.DialogProcessCallback(this.OnChallengeReceivedDialogProcessed)); }
private bool OnChallengeReceivedDialogProcessed(DialogBase dialog, object userData) { if (!this.DidReceiveChallenge()) { return(false); } this.m_challengeDialog = dialog; return(true); }
public void NextDialog(int selectedDialog) { if (currentDialog.events.Length > 0) { for (int i = 0; i < currentDialog.events.Length; i++) { if (selectedDialog == i) { if (currentDialog.events[i] != null) { print(currentDialog.events[i].ToString()); CallEvent(currentDialog.events[i], currentDialog.name); } break; } } } /* Vælger den næste dialog linje */ DialogBase oldDialog = currentDialog; DialogBase newDialog = oldDialog.nextDialogs[selectedDialog]; /* Hvis han ringer igen vælg anden dialog linje */ if (hasCalledBool == true && selectedDialog == 1 && fuckingHellM8 == true) { newDialog = dialogManager.callBackDialog[0]; fuckingHellM8 = false; } currentDialog = newDialog; /* DIALOG UI */ dialogTextUI.text = newDialog.dialogText; dialogTextUI.GetComponentInParent <Image>().color = boxColor; /* AUDIO */ if (newDialog.soundClip != null) { dialogSpeaker.clip = newDialog.soundClip; // Change the audio clip for current dialog dialogSpeaker.Stop(); dialogSpeaker.Play(); } /* ANSWERS UI */ for (int i = 0; i < questionTexts.Length; i++) { if (i < newDialog.questions.Length) { questionTexts[i].transform.parent.gameObject.SetActive(true); questionTexts[i].text = newDialog.questions[i]; } else { questionTexts[i].transform.parent.gameObject.SetActive(false); } } }
public void OpenOnceDialog(DialogBase dialog) { var activeDialog = InstantiateDialog(dialog.Name); activeDialog.SetActive(true); var activeDialogScript = activeDialog.GetComponent <AbstractDialog>(); activeDialogScript.InitDialog(dialog.Datas); }
private bool OnChallengeSentDialogProcessed(DialogBase dialog, object userData) { if (!this.DidSendChallenge()) { return(false); } this.m_challengeDialog = dialog; this.UpdateChallengeSentDialog(); return(true); }
/// <summary> /// Wires up event handlers for communication between the main form and the dialog /// </summary> /// <param name="dlg"></param> public void WireUpEventHandlers(DialogBase dlg) { dlg.BeginBusyEvent += new BeginBusyEventHandler(BeginBusy); dlg.UpdateStatusEvent += new UpdateStatusEventHandler(UpdateStatus); dlg.EndBusyEvent += new EndBusyEventHandler(EndBusy); dlg.ProgressReportBeginEvent += new ProgressReportBeginEventHandler(ProgressReportBegin); dlg.ProgressReportUpdateEvent += new ProgressReportUpdateEventHandler(ProgressReportUpdate); dlg.ProgressReportEndEvent += new SimpleEventHandler(ProgressReportEnd); }
public void EndPhoneCall() { Debug.Log("End Call"); dialogRunning = false; dialogCanvas.enabled = false; phoneCanvas.enabled = true; currentDialog = dialogManager.mainDialogs; boxColor = Color.white; dialogSpeaker.Stop(); }
// Update is called once per frame void Update() { //因为写入文件的操作必须在主线程中完成,所以在Update中哦给你写入文件。 if (mWriteTxt.Count > 0) { string[] temp = mWriteTxt.ToArray(); foreach (string t in temp) { if (Application.platform == RuntimePlatform.Android) { if (m_ajo == null) { AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); if (jc == null) { DialogBase.Show("ANDROID", "js is null"); return; } AndroidJavaObject jo = jc.GetStatic <AndroidJavaObject>("currentActivity"); if (jo == null) { DialogBase.Show("ANDROID", "jo is null"); return; } m_ajo = jo; } try { const string TAG = "FirstStudio.sloter"; m_ajo.Call("DebugLog", TAG, t); } catch (System.Exception e) { DialogBase.Show("ANDROID", e.Message); } } mWriteTxt.Remove(t); } } if (GlobalVars.instance.Testing && mDirty) { mDirty = false; string[] temp = mLines.ToArray(); string s = ""; foreach (string item in temp) { s += item; s += "\n"; } m_text.text = s; } }
public void SetDialogSp(DialogBase db, bool push) { dialogSp = true; //如果是任务加载的特殊对话,需要设置spIndex //如果是物品加载的特殊对话,无需设置,让其完成任务后下次对话自动触发对话,index==sp.count,然后跳出特殊对话。 if (push) { spIndex = specialDB.Count; } specialDB.Add(db); }
public void AfterRegisterByEmail() { DebugConsole.Log("AfterRegisterByEmail"); GlobalVars.instance.LoginType = Constants.Login_Email; GlobalVars.instance.LoginEmail = m_email; GlobalVars.instance.LoginPwd = m_pwdMD5; // 清空旧的GUID DebugConsole.Log("Clear old guid:" + GlobalVars.instance.LoginGuid); GlobalVars.instance.LoginGuid = ""; DialogBase.Show("Register by email", "Register successfully!"); }
private void OnChallengeReceivedDialogResponse(bool accept) { this.m_challengeDialog = null; if (accept) { this.AcceptChallenge(); } else { this.DeclineChallenge(); } }
private DialogForm(DialogBase content) : this() { _dialog = content; if(content != null) { UpdateSize(); ShowContent(); content.SizeChanged += OnContentSizeChanged; _expandable = content as IExpandableDialog; if(_expandable != null) { _expanded = true; var exDialog = (IExpandableDialog)content; CreateBitmaps(exDialog.ExpansionName); _picAdvanced.Visible = true; _expansionControl = exDialog.ExpansionControl; } _elevated = content as IElevatedExecutableDialog; _executable = content as IExecutableDialog; } }
void OnChoiceSelected(int selected) { displayingChoice = true; DialogChoice choiceEvent = currentDialogEvent as DialogChoice; int cost = choiceEvent.choiceCost [selected]; if (!PlayerProfile.Get ().IsActionAvailable(cost)) { return; } PlayerProfile.Get ().StartAction (cost); if (cost < 0) { GameObject obj = NGUITools.AddChild (scenePanel.gameObject, Resources.Load ("Prefabs/Emitter") as GameObject); Vector3 newPos = obj.transform.localPosition; newPos.x = -scenePanel.transform.localPosition.x; newPos.y -= (170 + 90 * selected); obj.transform.localPosition = newPos; Emitter emitter = obj.GetComponent<Emitter> (); emitter.Init (new ItemType[]{ItemType.ENERGY}, new int[]{choiceEvent.choiceEnergyReward [selected]}, -20f, 20f, 60f, 60f, Emitter.EmitType.Flow); emitter.Init (new ItemType[]{ItemType.GOLD}, new int[]{choiceEvent.choiceMoneyReward [selected]}, -20f, 20f, 60f, 60f, Emitter.EmitType.Flow); } if (choiceEvent.nextEvents.Count > 0){ currentDialogEvent = choiceEvent.nextEvents [selected]; } else { currentDialogEvent = choiceEvent.nextEvent; } foreach (QuestChoiceOption option in choiceList) { Destroy(option.gameObject); } // UITweener tween = choiceRoot.GetComponent<UITweener>(); // tween.Play (false); choiceTweenAlpha.Play (false); choiceTweenPos.Play (false); choiceList.Clear (); // ShowCurrentDialog (); // textLabel.text = choiceEvent.choiceOptions [selected]; playerText.text = choiceEvent.choiceOptions [selected]; playerNameLabel.text = PlayerProfile.Get ().playerName; textCollider.enabled = true; // playerTextTweenIn.Play (true); // otherTextTween.Play (false); // playerTextGroup.SetActive (true); // otherTextGroup.SetActive (false); ShowDialogBoxes (true, false); // Drama currentDrama = currentScene.eventList [currentScene.currentEvent] as Drama; Drama currentDrama = currentScene.getCurrentEvent () as Drama; currentDrama.relationshipBonus += choiceEvent.choiceReward [selected]; }
void OnNext() { if (displayingChoice == false && currentDialogEvent != null) { currentDialogEvent = currentDialogEvent.nextEvent; ShowCurrentDialog (); } else { ShowCurrentDialog (); } }
void StartDrama(Drama selectedDrama) { m_hudService.HUDControl.EnableRanking (false); float dialogLoc = selectedDrama.loc.x - 50f; Vector3 pos = scenePanel.transform.localPosition; // float diff = pos.x - dialogLoc; pos.x = -dialogLoc; SpringPanel.Begin (scenePanel.gameObject, pos, 8f); // scenePanel.transform.localPosition = pos; // // Vector4 clipPos = scenePanel.clipRange; // clipPos.x = dialogLoc; // scenePanel.clipRange = clipPos; LoadDialog (selectedDrama.file); // pos = dialogBase.transform.localPosition; // pos.x = dialogLoc; // dialogBase.transform.localPosition = pos; dialogBase.SetActive (true); pos = playerChara.transform.localPosition; pos.x = currentScene.playerPos.x; playerChara.transform.localPosition = pos; Vector3 scale = playerChara.transform.localScale; scale.x *= selectedDrama.direction; playerChara.transform.localScale = scale; currentDialogEvent = openingDialogEvent; //move it to after the event dialog is loaded ShowCurrentDialog (); displayingChoice = false; EnableMapScroll (false); if (questProgress != null) { questProgress.gameObject.SetActive (false); } if (selectedDrama.startChain) PlayerProfile.Get ().currentEventSet = selectedDrama.chain; }
void LoadDialog(string[] questDialog) { ParseMode parseMode = ParseMode.None; DialogBase currentDialogEvent = null; characterList = new List<Character>(); int currentBranch = 0; int currentChoiceIndex = 0; int maxBranch = currentBranch; List<int> branchQueue = new List<int> (); List<int> priorityQueue = new List<int> (); List<int> finishedQueue = new List<int> (); //for pending branches to be merged later bool mergePending = false; priorityQueue.Add (currentBranch); foreach (string dataLine in questDialog) { if (dataLine == "<Chara>"){ parseMode = ParseMode.Character; continue; } else if (dataLine == "<Dialog>"){ parseMode = ParseMode.Dialog; continue; } else if (dataLine == "<Choice>"){ parseMode = ParseMode.Choice; continue; } else if (dataLine == "<ChoiceOptions>"){ parseMode = ParseMode.ChoiceOptions; continue; }else if (dataLine == "<End>"){ break; } else if (dataLine == "<ChoiceEnd>"){ finishedQueue.Insert (0, currentBranch); priorityQueue.RemoveAt (0); currentBranch = priorityQueue[0]; if (currentBranch == branchQueue[0]) mergePending = true; continue; } DialogBase nextEvent = null; switch (parseMode){ case ParseMode.Character: { string[] parts = dataLine.Split(new char[] {',',':'}); characterList.Add(new Character(int.Parse(parts[0]), parts[1])); } break; case ParseMode.Dialog: { string[] parts = dataLine.Split(new char[] {'^'}); DialogLine newDialogLine = new DialogLine(); newDialogLine.eventGroup = currentBranch; newDialogLine.characterID = int.Parse(parts[0]); newDialogLine.dialogLine = parts[1].Replace("<playername>", PlayerProfile.Get ().playerName).Replace("\\n", System.Environment.NewLine); newDialogLine.anims = null; if (parts.Length > 2){ string[] anims = parts[2].Split (new char[]{','}); newDialogLine.anims = new string[anims.Length]; for (int i = 0; i < anims.Length; ++i){ newDialogLine.anims[i] = anims[i]; } if (parts.Length > 3){ newDialogLine.isLoopAnim = (parts[3] == "L"); } } nextEvent = newDialogLine; } break; case ParseMode.Choice: { string[] parts = dataLine.Split(new char[] {'^'}); DialogChoice newChoice = new DialogChoice(); int branchCount = int.Parse(parts[1]); newChoice.eventGroup = currentBranch; newChoice.choiceOptions = new string[branchCount]; newChoice.choiceCost = new int[branchCount]; newChoice.choiceReward = new int[branchCount]; newChoice.choiceEnergyReward = new int[branchCount]; newChoice.choiceMoneyReward = new int[branchCount]; parseMode = ParseMode.ChoiceOptions; currentChoiceIndex = 0; // newChoice.eventGroup = currentBranch; // newChoice.choiceOptions = new string[parts.Length]; // newChoice.choiceCost = new int[parts.Length]; // newChoice.choiceReward = new int[parts.Length]; // // int i = 0; // // foreach (string choiceLine in parts){ // string[] lineParts = choiceLine.Split(new string[]{"::"}, System.StringSplitOptions.None); // newChoice.choiceCost[i] = int.Parse(lineParts[0].Split (':')[1]); // newChoice.choiceReward[i] = int.Parse(lineParts[2].Split (':')[1]); // newChoice.choiceOptions[i++] = lineParts[1]; // maxBranch = maxBranch + i; // priorityQueue.Insert(0, maxBranch); // } // // branchQueue.Insert(0, currentBranch); //store last branch node // currentBranch = priorityQueue[0]; //remove first node from pq // // parseMode = ParseMode.Dialog; // branchQueue.Add (currentBranch); nextEvent = newChoice; } break; case ParseMode.ChoiceOptions: { DialogChoice currentChoice = currentDialogEvent as DialogChoice; string[] parts = dataLine.Split(new char[] {'^'}); currentChoice.choiceCost[currentChoiceIndex] = int.Parse(parts[0]); currentChoice.choiceOptions[currentChoiceIndex] = parts[1]; currentChoice.choiceReward[currentChoiceIndex] = int.Parse (parts[2]); currentChoice.choiceMoneyReward[currentChoiceIndex] = int.Parse (parts[3]); currentChoice.choiceEnergyReward[currentChoiceIndex] = int.Parse (parts[4]); currentChoiceIndex++; maxBranch = maxBranch + currentChoiceIndex; priorityQueue.Insert(0, maxBranch); if (currentChoiceIndex >= currentChoice.choiceCost.Length){ branchQueue.Insert(0, currentBranch); //store last branch node currentBranch = priorityQueue[0]; //remove first node from pq parseMode = ParseMode.Dialog; } continue; } break; } if (currentDialogEvent == null){ openingDialogEvent = nextEvent; } else{ if (currentDialogEvent.eventGroup == nextEvent.eventGroup) currentDialogEvent.nextEvent = nextEvent; else{ int lastBranch = branchQueue[0]; if (lastBranch != priorityQueue[0]) //branch splitting { currentDialogEvent = openingDialogEvent.FindBranch(lastBranch); // while (currentDialogEvent.eventGroup != lastBranch && currentDialogEvent.eventType != DialogBase.EventType.Choice){ // currentDialogEvent = currentDialogEvent.nextEvent; // } DialogChoice branchEvent = (DialogChoice)currentDialogEvent; branchEvent.nextEvents.Add (nextEvent); }else{ //branch merging foreach (int finishedIndex in finishedQueue){ currentDialogEvent = openingDialogEvent.FindLeaf(finishedIndex); currentDialogEvent.nextEvent = nextEvent; } finishedQueue.Clear (); branchQueue.RemoveAt(0); } } } currentDialogEvent = nextEvent; } charactersInScene = characterList.ToArray (); currentDialogEvent = openingDialogEvent; currentDialogEvent.DumpContents (); // while (currentDialogEvent != null) { // DialogLine dialog = currentDialogEvent as DialogLine; // Debug.Log(dialog.dialogLine + "\n"); // // currentDialogEvent = currentDialogEvent.nextEvent; // } }