public void ShowDialog( DialogItem item ) { if ( item == null || string.IsNullOrEmpty( item.text ) ) throw new System.ArgumentException( "item" ); panel.SetActive( true ); question.text = item.text; for ( int i = 0; i < replyButtons.Length; i++ ) { var button = replyButtons[ i ]; // show only as many buttons as we have replies bool show = i < item.replies.Count; button.gameObject.SetActive( show ); if ( show ) { var reply = item.replies[ i ]; button.onClick = reply.effect; // hide dialog when button is pressed button.onClick.AddListener( () => HideDialog() ); // show target dialog when button is pressed if ( reply.nextDialog != null ) button.onClick.AddListener( () => ShowDialog( reply.nextDialog ) ); // set the label text button.GetComponentInChildren<Text>().text = reply.text; } } }
public void DynamicCustom() { DivisorItem divisorItem = new DivisorItem(1); TextItem textItem = new TextItem("Dynamic Test!", Color.blue); SwitchItem switchItem1 = new SwitchItem("Switch item1", "switch1", true); SwitchItem switchItem2 = new SwitchItem("Switch item2", "switch2", false); SliderItem sliderItem1 = new SliderItem("Slider item1", "slider1", 50, 0, 100, 0, 0, ""); SliderItem sliderItem2 = new SliderItem("Slider item2", "slider2", 0.5f, 0, 1, 2, 0, ""); ToggleItem toggleItem = new ToggleItem( new String[] { "Toggle1", "Toggle2" }, "toggles", new String[] { "toggle value1", "toggle value2" }, "value2"); DialogItem[] items = new DialogItem[] { divisorItem, textItem, switchItem1, switchItem2, sliderItem1, sliderItem2, toggleItem }; if (customControl != null) { customControl.SetItem(items); customControl.Show(); XDebug.Log("CurrentValue : " + customControl.CurrentValue.Select(e => e.Key + "=" + e.Value).Aggregate((s, a) => s + ", " + a)); } }
void HitChoice(int choice) { if (selectedDialog != this) { return; } DialogItem item = dialogs[currentDialog]; if (!item.completed && item.itemReward.itemName != "") { item.completed = true; Inventory.Drop(transform.position, item.itemReward.itemName); } if (item.choises.Count < choice + 1) { return; } int next = FindDialogId(item.choises[choice].nextDialog); if (next < 0) { return; } currentDialog = next; DrawDialog(); }
async Task ShowDialog(DialogItem dialogItem) { var chosenButton = await this.speechBubble.ShowAsync( dialogItem.speech, dialogItem.buttons .FilterForPreconditions( this.playerChoiceService, button => button.preconditions) .ToArray()); if (chosenButton.choice != PlayerChoice.Undefined) { this.playerChoiceService.RecordChoice(chosenButton.choice, chosenButton.choiceValue); } Debug.Log("Result: " + chosenButton.text); await this.coroutineRunner.RunCoroutineAsTask(this.HandleResult(chosenButton.choice, chosenButton.choiceValue)); var reaction = chosenButton.reactionText; if (!string.IsNullOrEmpty(reaction)) { await this.ShowReaction(reaction); } }
public void handleClick() { if (!textInteraction.gameObject.activeSelf) { textInteraction.gameObject.SetActive(true); } if (dialogsItems[index] as AlertDialogueItem) { AlertDialogueItem item = dialogsItems[index] as AlertDialogueItem; textInteraction.Message = item.Message; textInteraction.FontColor = item.AlertColor; } else { DialogItem item = dialogsItems[index] as DialogItem; textInteraction.Message = item.Message; textInteraction.FontColor = Color.white; } //textInteraction.Message = dialogsItems[index].Message; //Debug.Log(dialogsItems[index].); //index = index + 1 < dialogsItems.Count ? index + 1 : 0; if (!(index + 1 < dialogsItems.Count)) { index = 0; HandleTextInteraction(); } else { index++; } }
public DialogItem AddNewItem() { DialogItem item = new DialogItem(); dialogItems.Add(item); return(item); }
public ResultsPopup() { InitializeComponent(); viewResults.Groups.Add(resultGroupRecentlyUsed); viewResults.Groups.Add(resultGroupMenu); viewResults.Groups.Add(resultGroupPreferences); MainMenu = new MenuItem(IntPtr.Zero); PreferenceDialog = new DialogItem("Preferences"); // Lazy initializing the dialog on first search then steals the keyboard focus :( So do it here. InitPreferencesDialog(); Main.NppListener.AfterReloadNativeLang += new EventHandler(NppListener_AfterReloadNativeLang); Main.MakeNppOwnerOf(this); viewResults.ContextMenu = popupMenu; if (Main.PreferredResultsWindowSize.Width > 0 && Main.PreferredResultsWindowSize.Height > 0) { Size = Main.PreferredResultsWindowSize; } }
private void FinishCharacterShowing() { DialogItem dialog = dialogs[currentDialog]; dialogText.text = dialog.text; characterShowing = false; }
public override void Initilize(ref DialogItem owner, NodeActionType type) { looker = LoadFromTag(lookerTag); prevLooker = looker; looktAtTarget = looktAtTarget = LoadFromTag(targetTag); prevTarget = looktAtTarget; base.Initilize(ref owner, type); }
// Start is called before the first frame update void Start() { // Init a bunch of empty dialog lines for (int i = 0; i < 20; i++) { dialogs[i] = new DialogItem(); } canvasGroup = this.GetComponent <CanvasGroup>(); }
void ChangeDialogItem(DialogItem d) { DialogStateIndex = 0; this.CurrentDialogItem = d; AvailableDialogOptions = CurrentDialogItem.Links.Select(i => this.State.Dialog.FirstOrDefault(di => di.Id == i)).ToList(); if (d.OnSelect != null) { d.OnSelect(); } }
private void DrawChoices(DialogItem item) { int delete = -1; if (item.choises == null) { item.choises = new List <DialogChoise>(); item.choises.Add(new DialogChoise()); } for (int i = 0; i < item.choises.Count; i++) { DialogChoise choice = item.choises[i]; EditorGUI.BeginChangeCheck(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("choice - " + i); if (GUILayout.Button("-", GUILayout.Width(40))) { delete = i; } EditorGUILayout.EndHorizontal(); int previousIndentLevel = EditorGUI.indentLevel; EditorGUI.indentLevel = 2; string cs = EditorGUILayout.TextField("Text", choice.caption); string ns = EditorGUILayout.TextField("Next dialog ID", choice.nextDialog); EditorGUI.indentLevel = previousIndentLevel; if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Changed choice " + i); choice.caption = cs; choice.nextDialog = ns; } } if (item.choises.Count < 3) { EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("+", GUILayout.Width(40))) { item.choises.Add(new DialogChoise()); } EditorGUILayout.EndHorizontal(); } if (delete > -1) { item.choises.RemoveAt(delete); } }
private void OnDialogShow(DialogItem dialogItem) { if (dialogItem.Dialog.Length > 0) { _dialog.Clear(); _dialog.AddRange(dialogItem.Dialog); SetNamePlate(dialogItem.Speaker); StartCoroutine(ShowDialog()); } else { GameSignals.DIALOG_CLOSE.Dispatch(true); throw new ArgumentException($"Null dialog passed with signal. Speaker: {dialogItem.Speaker}"); } }
private void DelDialogItem() { DialogItem item = null; BaseDialogItem tmp; for (int i = 0; i < _itemCount; i++) { tmp = _items[i]; if (tmp != null && tmp.GetItemType() == eItemType.Dialog) { item = tmp as DialogItem; item.Delete(); return; } } }
private void fillDialog(DialogItem item) { //TODO: make the images come in from the sides with an animation if (item.characterName == DialogItem.CharacterName.Poseidon) { poseidonImage.SetActive(true); aphroditeImage.SetActive(false); } else { poseidonImage.SetActive(false); aphroditeImage.SetActive(true); } characterName.text = item.characterName.ToString(); dialogText.text = item.dialogText; }
void ItemSelected() { if (viewResults.SelectedItems.Count == 0) { return; } MenuItem menuItem = viewResults.SelectedItems[0].Tag as MenuItem; if (menuItem != null) { Main.RecentlyUsedCommands.Remove(menuItem.CommandId); Main.RecentlyUsedCommands.AddFirst(menuItem.CommandId); //Console.WriteLine("Selected {0}", item.CommandId); Win32.SendMessage(PluginBase.nppData._nppHandle, (NppMsg)Win32.WM_COMMAND, (int)menuItem.CommandId, 0); Hide(); OwnerTextBox.Text = ""; if (OwnerTextBox.Focused) { Win32.SetFocus(PluginBase.GetCurrentScintilla()); } Main.RecalcRepeatLastCommandMenuItem(); OnFinished(); return; } DialogItem dialogItem = viewResults.SelectedItems[0].Tag as DialogItem; if (dialogItem != null) { Main.RecentlyUsedCommands.Remove(dialogItem.ControlId); Main.RecentlyUsedCommands.AddFirst(dialogItem.ControlId); OpenPreferences(dialogItem.ControlId); Hide(); OwnerTextBox.Text = ""; OnFinished(); return; } }
private void UpdateCharacterShowing() { if (Time.time > characterLastTime + characterWriteDuration) { characterNumber++; characterLastTime = Time.time; } DialogItem dialog = dialogs[currentDialog]; dialogText.text = dialog.text.Substring(0, characterNumber); // Force name update because of contentSizeFitter bugs... dialogNameText.text = dialog.name + (characterNumber % 2 == 0 ? " " : ""); if (characterNumber >= dialog.text.Length) { characterShowing = false; } }
protected void InitPreferencesDialog() { PreferenceDialogHelper pdh = new PreferenceDialogHelper(); pdh.LoadCurrentLocalization(); IntPtr hwndDialogPage; PreferenceDialog = new DialogItem(pdh.PageTranslations[pdh.Global.InternalName]); hwndDialogPage = DialogHelper.LoadNppDialog(Handle, (int)pdh.Global.ResourceId); try { PreferenceDialog = DialogItem.CreateFromDialogFlat(hwndDialogPage, pdh.PageTranslations[pdh.Global.InternalName]); } finally { DialogHelper.DestroyWindow(hwndDialogPage); } foreach (var pageInfo in pdh.GetPages()) { hwndDialogPage = DialogHelper.LoadNppDialog(Handle, (int)pageInfo.ResourceId); try { DialogItem pageItem = DialogItem.CreateFromDialogFlat(hwndDialogPage, pdh.PageTranslation(pageInfo.InternalName)); pageItem.ReorderItemsByGroupBoxes(hwndDialogPage); PreferenceDialog.AddItem(pageItem); } finally { DialogHelper.DestroyWindow(hwndDialogPage); } } PreferenceDialog.Translate(pdh.ControlTranslations); PreferenceDialog.RemoveRedundantHeadings(); }
private float FillFrameWithCard(GameObject frame, List <CardInfo> cards, List <DialogItem> dialogList, float start, float incr) { if (cards.Count == 0) { frame.SetActive(false); return(start); } else { frame.SetActive(true); } dialogList.Clear(); var cardFrame = frame.FindObject("CardFrame"); foreach (Transform t in cardFrame.transform) { Destroy(t.gameObject); } var prefab = Resources.Load <GameObject>("Dynamic-PC/PCBoardCard-Small"); int index = 0; for (; index < cards.Count; index++) { var card = cards[index]; DialogItem item = new DialogItem { Card = card, CardObject = Instantiate(prefab) }; item.CardObject.transform.parent = cardFrame.transform; item.CardObject.transform.localPosition = new Vector3(start + index * incr, 0f, -0.1f); item.CardObject.GetComponent <PCBoardCardDisplayBehaviour>().Bind(item.Card); dialogList.Add(item); } return(index * incr); }
/// <summary> /// Interacts with a character or object. /// </summary> /// <param name="interactingCharacter">Who or what to interact with.</param> public void InteractWith(Transform interactingCharacter) { if (_state != NpcState.Idle) { return; } _state = NpcState.Interacting; ChangeDirection(interactingCharacter.position); if (_dialog.Count > 0) { var dialog = new DialogItem(_dialog.ToArray(), _name); GameSignals.DIALOG_OPEN.Dispatch(true); GameSignals.DIALOG_SHOW.Dispatch(dialog); } else { // Skip the call to ShowDialog() because it would cause an exception. _idleTimer = 0f; _state = NpcState.Idle; } }
private void popupMenu_Popup(object sender, EventArgs e) { menuGotoShortcutDefinition.Enabled = false; menuOpenDialog.Visible = false; if (viewResults.SelectedItems.Count > 0) { MenuItem menuItem = viewResults.SelectedItems[0].Tag as MenuItem; if (menuItem != null) { menuGotoShortcutDefinition.Enabled = true; } DialogItem dialogItem = viewResults.SelectedItems[0].Tag as DialogItem; if (dialogItem != null) { menuOpenDialog.Visible = true; } } menuExecuteMenuItem.Visible = !menuOpenDialog.Visible; }
public void ShowDialog(DialogItem item) { if (item == null || string.IsNullOrEmpty(item.text)) { throw new System.ArgumentException("item"); } panel.SetActive(true); question.text = item.text; for (int i = 0; i < replyButtons.Length; i++) { var button = replyButtons[i]; // show only as many buttons as we have replies bool show = i < item.replies.Count; button.gameObject.SetActive(show); if (show) { var reply = item.replies[i]; button.onClick = reply.effect; // hide dialog when button is pressed button.onClick.AddListener(() => HideDialog()); // show target dialog when button is pressed if (reply.nextDialog != null) { button.onClick.AddListener(() => ShowDialog(reply.nextDialog)); } // set the label text button.GetComponentInChildren <Text>().text = reply.text; } } }
void DrawDialog() { textCaption.text = caption; if (currentDialog < 0) { return; } DialogItem item = dialogs[currentDialog]; textText.text = item.description; string choice = ""; for (int i = 0; i < item.choises.Count; i++) { if (item.choises[i].caption != "") { choice += string.Format("{0} {1}\n", i + 1, item.choises[i].caption); } } textChoice.text = choice; }
private int DrawItem(int id, DialogItem item) { int delete = -1; EditorGUILayout.BeginVertical("box"); EditorGUI.BeginChangeCheck(); EditorGUILayout.BeginHorizontal(); string ns = EditorGUILayout.TextField("Dialog ID", item.idString); if (GUILayout.Button("-", GUILayout.Width(40))) { delete = id; } EditorGUILayout.EndHorizontal(); var ele = dialogsProp.GetArrayElementAtIndex(id); EditorGUILayout.PropertyField(ele.FindPropertyRelative("itemReward"), new GUIContent("Reward")); string ds = EditorGUILayout.TextArea(item.description, GUILayout.Height(50)); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Changed item " + id); item.description = ds; item.idString = ns; } DrawChoices(item); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); return(delete); }
public void Remove(DialogItem item) { dialogItems.Remove(item); }
const string JSON_PREF = "_json"; //JSON とは保存データを分ける public void OpenDialog() { if (toggleJson != null && toggleJson.isOn) //JSON 形式 { #if UNITY_ANDROID Data data = new Data(); XPlayerPrefs.GetObjectOverwrite(gameObject.name + JSON_PREF, ref data); //保存されたデータがないときはデフォ値となる XDebug.Clear(); //※ヒエラルキーにある「DebugConsole」をオンにすると内容が見れます。 XDebug.Log("(PlayerPrefs or init)"); XDebug.Log(data, 3); DivisorItem divisorItem = new DivisorItem(1); TextItem textItem = new TextItem("あんなことやこんなことを設定できます。"); TextItem textItem1 = new TextItem("嫁のブレンド・S"); SwitchItem switchItem = new SwitchItem("ユニティちゃん", "utc", data.utc); SwitchItem switchItem2 = new SwitchItem("プロ生ちゃん", "pronama", data.pronama); SwitchItem switchItem3 = new SwitchItem("クエリちゃん", "query", data.query); TextItem textItem2 = new TextItem("あなたの属性"); ToggleItem toggleItem = new ToggleItem( new String[] { "ツンデレ", "ヤンデレ", "しょびっち" }, "zokusei", new String[] { "tsundere", "yandere", "syobicchi" }, data.zokusei); TextItem textItem3 = new TextItem("サウンド設定"); Dictionary <string, int> vols; if (volumeController != null) { vols = volumeController.GetVolumes(); } else { vols = new Dictionary <string, int>() { { "master", 100 }, { "bgm", 50 }, { "voice", 50 }, { "se", 50 } } }; SliderItem sliderItem = new SliderItem("マスター", "master", vols["master"], 0, 100, 0, 0, "PreviewVolume"); SliderItem sliderItem1 = new SliderItem("音楽", "bgm", vols["bgm"], 0, 100, 0, 0, "PreviewVolume"); SliderItem sliderItem2 = new SliderItem("ボイス", "voice", vols["voice"], 0, 100, 0, 0, "PreviewVolume"); SliderItem sliderItem3 = new SliderItem("効果音", "se", vols["se"], 0, 100, 0, 0, "PreviewVolume"); TextItem textItem4 = new TextItem("リセットすると保存された設定が全て消去されます", Color.red); SwitchItem switchItem4 = new SwitchItem("設定のリセット", "reset", false, Color.blue); DialogItem[] items = new DialogItem[] { textItem, divisorItem, textItem1, switchItem, switchItem2, switchItem3, divisorItem, textItem2, toggleItem, divisorItem, textItem3, sliderItem, sliderItem1, sliderItem2, sliderItem3, divisorItem, switchItem4, textItem4, divisorItem, }; #endif #if UNITY_ANDROID && !UNITY_EDITOR AndroidPlugin.ShowCustomDialog("設定いろいろ", "", items, gameObject.name, "OnReceiveResult", true, "決定", "キャンセル"); #endif } else //キーと値ペアの形式 { #if UNITY_ANDROID //Param は基本的に Dictionary と同じもので、値の型変換とデフォルト値を簡単に扱うために用意したラッパー的なクラスと考えて良い Param pref = Param.GetPlayerPrefs(gameObject.name, new Param()); //保存されたデータがないときは新規に生成(中身は空) XDebug.Clear(); //※ヒエラルキーにある「DebugConsole」をオンにすると内容が見れます。 XDebug.Log("(PlayerPrefs or init)"); XDebug.Log(pref, 3); DivisorItem divisorItem = new DivisorItem(1); TextItem textItem = new TextItem("あんなことやこんなことを設定できます。"); TextItem textItem1 = new TextItem("嫁のブレンド・S", AndroidColor.WHITE, XColor.ToIntARGB("#ff1493"), "center"); //※色の形式はどれでも同じです(テストで色々試してるだけ) SwitchItem switchItem = new SwitchItem("ユニティちゃん", "utc", pref.GetBool("utc", false)); SwitchItem switchItem2 = new SwitchItem("プロ生ちゃん", "pronama", pref.GetBool("pronama", false)); SwitchItem switchItem3 = new SwitchItem("クエリちゃん", "query", pref.GetBool("query", false)); TextItem textItem2 = new TextItem("あなたの属性", XColor.ToColor("#fff"), XColor.ToColor("0x1e90ff"), "center"); //※色の形式はどれでも同じです(テストで色々試してるだけ) ToggleItem toggleItem = new ToggleItem( new String[] { "ツンデレ", "ヤンデレ", "しょびっち" }, "zokusei", new String[] { "tsundere", "yandere", "syobicchi" }, pref.GetString("zokusei", "tsundere")); TextItem textItem3 = new TextItem("サウンド設定", XColor.ToIntARGB(Color.white), XColor.ToIntARGB(0x3c, 0xb3, 0x71), "center");//"#3cb371" ※色の形式はどれでも同じです(テストで色々試してるだけ) Dictionary <string, int> vols; if (volumeController != null) { vols = volumeController.GetVolumes(); } else { vols = new Dictionary <string, int>() { { "master", 100 }, { "bgm", 50 }, { "voice", 50 }, { "se", 50 } } }; SliderItem sliderItem = new SliderItem("マスター", "master", vols["master"], 0, 100, 0, 0, "PreviewVolume"); SliderItem sliderItem1 = new SliderItem("音楽", "bgm", vols["bgm"], 0, 100, 0, 0, "PreviewVolume"); SliderItem sliderItem2 = new SliderItem("ボイス", "voice", vols["voice"], 0, 100, 0, 0, "PreviewVolume"); SliderItem sliderItem3 = new SliderItem("効果音", "se", vols["se"], 0, 100, 0, 0, "PreviewVolume"); TextItem textItem4 = new TextItem("リセットすると保存された設定が全て消去されます", Color.red); SwitchItem switchItem4 = new SwitchItem("設定のリセット", "reset", false, Color.blue); DialogItem[] items = new DialogItem[] { textItem, divisorItem, textItem1, switchItem, switchItem2, switchItem3, divisorItem, textItem2, toggleItem, divisorItem, textItem3, sliderItem, sliderItem1, sliderItem2, sliderItem3, divisorItem, switchItem4, textItem4, divisorItem, }; #endif #if UNITY_ANDROID && !UNITY_EDITOR AndroidPlugin.ShowCustomDialog("設定いろいろ", "", items, gameObject.name, "OnReceiveResult", false, "決定", "キャンセル"); #endif } }
void Awake() { _instance = this; }
//****************************************************************** private void RunNodeAction(DialogItem Node, NodeActionType type) { //Debug.Log("Running node actions: " + type); switch (type) { case NodeActionType.OnDialogFocused: foreach (NodeAction dialogItem in Node.onNodeFocusedActions) { dialogItem.DoAction(); } break; case NodeActionType.OnDialogLeave: foreach (NodeAction dialogItem in Node.onNodeLeaveActions) { dialogItem.DoAction(); } break; } }
public override void Initilize(ref DialogItem owner, NodeActionType type) { base.Initilize(ref owner, type); //if (mHashID != "") //{ // Debug.Log("Loading Object hash"); // nodeTarget = LoadFromHash(mHashID); // if (nodeTarget != null) // { // prev = nodeTarget; // } //} if(nodeTarget == null) { //Debug.Log("Loading tag: " + objectTag); nodeTarget = LoadFromTag(objectTag); if (nodeTarget != null) { prev = nodeTarget; } } }
public virtual void Initilize(ref DialogItem owner, NodeActionType type) { mOwner = owner; mActionType = type; }
private void Update() { if (actor) { transform.position = actor.position; } if (!canvas) { return; } if (!cameraTransform) { return; } switch (kind) { case DialogKind.FadeInOut: case DialogKind.OnEnter: CheckDistance(); break; case DialogKind.OnKey: CheckKey(); break; } if (!SM.dialogOpened) { return; } if (currentDialog < 0) { return; } DialogItem item = dialogs[currentDialog]; if (item.choises.Count < 1) { return; } if (SM.dialogChoice1) { HitChoice(0); return; } if (SM.dialogChoice2) { HitChoice(1); return; } if (SM.dialogChoice3) { HitChoice(2); return; } }
public ExtractDialogItemCode(DialogItem item, bool extractDesignerCode) { this.item = item; ExtractDesignerCode = extractDesignerCode; }
public void AddDialogFile(DialogItem item, MyEditor text = null) { ProjectProperties.CurrentProjectPropperties.CompileStatus = ProjectProperties.ECompileStatus.Changed; //Check if it already exists foreach (SourceFileContents sourceFile in ParsedSourceFiles) { if (sourceFile.Item == item) return; } SourceFileContents contents = new SourceFileContents(); contents.Item = item; contents.GetSource = new ExtractDialogItemCode(item, false).Extract; ParsedSourceFiles.Add(contents); liteCompileQueue.Add(new KeyValuePair<SourceFileContents, MyEditor>(contents, text)); SourceFileContentsChanged(contents); contents = new SourceFileContents(); contents.Item = item; contents.IsDialogDesigner = true; contents.GetSource = new ExtractDialogItemCode(item, true).Extract; ParsedSourceFiles.Add(contents); liteCompileQueue.Add(new KeyValuePair<SourceFileContents, MyEditor>(contents, text)); SourceFileContentsChanged(contents); SignalLiteCompiler(); }
public void DialogItemChanged(DialogItem file, MyEditor contents, bool isDesigner = false) { ProjectProperties.CurrentProjectPropperties.CompileStatus = ProjectProperties.ECompileStatus.Changed; //If its already in the compile queue, update the text for (int i = 0; i < liteCompileQueue.Count; i++) { if (liteCompileQueue[i].Key.Item == file && liteCompileQueue[i].Key.IsDialogDesigner == isDesigner) { liteCompileQueue[i] = new KeyValuePair<SourceFileContents, MyEditor>(liteCompileQueue[i].Key, contents); SignalLiteCompiler(); return; } } //Otherwise, add it foreach (SourceFileContents t in ParsedSourceFiles) { if (t.Item == file && t.IsDialogDesigner == isDesigner) { liteCompileQueue.Add(new KeyValuePair<SourceFileContents, MyEditor>(t, contents)); } } SignalLiteCompiler(); }
public void RemoveDialogItem(DialogItem file) { ProjectProperties.CurrentProjectPropperties.CompileStatus = ProjectProperties.ECompileStatus.Changed; for (int i = 0; i < ParsedSourceFiles.Count; i++) { if (ParsedSourceFiles[i].Item == file) { ParsedSourceFiles.RemoveAt(i); i--; } } for (int i = 0; i < liteCompileQueue.Count; i++) { if (liteCompileQueue[i].Key.Item == file) { liteCompileQueue.RemoveAt(i); i--; } } }
/// <summary> /// /// </summary> /// <param name="cmd"></param> /// <param name="args"></param> public void Execute(int cmd, object data) { switch (cmd) { case CommandConsts.StartDialog: _timeSinceStarted = 0; break; case CommandConsts.CreateDialogCG: { List <object> datas = data as List <object>; CharacterItem item = new CharacterItem(_containerTf); item.Init(datas[0] as string, datas[1] as string, (float)datas[2], (float)datas[3]); AddItem(item); break; } case CommandConsts.HighlightDialogCG: { List <object> datas = data as List <object>; CharacterItem item = GetCGItemByName(datas[0] as string); if (item != null) { item.Highlight((bool)datas[1]); } break; } case CommandConsts.FadeOutDialogCG: { CharacterItem item = GetCGItemByName(data as string); if (item != null) { item.FadeOut(); } break; } case CommandConsts.CreateDialogBox: { List <object> datas = data as List <object>; DialogItem item = new DialogItem(_containerTf); item.Init((int)datas[0], datas[1] as string, (float)datas[2], (float)datas[3], (int)datas[4], (float)datas[5]); AddItem(item); break; } case CommandConsts.DelDialogBox: DelDialogItem(); break; case CommandConsts.UpdateDialog: { int dTime = data == null ? 1 : (int)data; UpdateDialog(dTime); break; } case CommandConsts.PauseGame: OnSTGPause(); break; case CommandConsts.ContinueGame: OnSTGContinue(); break; case CommandConsts.ContinueGameAfterGameOver: OnSTGContinue(); break; case CommandConsts.RetryGame: OnRetry(); break; case CommandConsts.RetryStage: OnRetry(); break; case CommandConsts.BackToTitle: OnRetry(); break; } }
//****************************************************************** private void Talk(DialogItem d) { jumped = false; //if (d.speaker == Speakers.Player) //{ // Talking = false; // branching = true; //} //if (d.speaker == Speakers.NPC) //{ // branching = false; // Talking = true; //} //check thos if(currentPlayingClip != null)Destroy(currentPlayingClip); focusedNode = d; //Debug.Log("Talking"); RunNodeAction(d, NodeActionType.OnDialogFocused); //float WaitTime = 0f; if(d.is_branch)return; switch (d.wait) { case Waits.Audio: currentPlayingClip = SoundManager.Play3DSoundWithCallback(gameObject, d.spoken, new SoundCallBack(IncrementNode)); ; break; case Waits.Time: WaitTimer.StartTimer(d.waitTime); break; } }
const string JSON_PREF = "_json"; //For save JSON parameters //Call Android Custom Dialog //http://fantom1x.blog130.fc2.com/blog-entry-282.html#fantomPlugin_CustomDialogItems public void OpenDialog() { if (toggleJson != null && toggleJson.isOn) //JSON format { #if UNITY_ANDROID Data data = new Data(); XPlayerPrefs.GetObjectOverwrite(gameObject.name + JSON_PREF, ref data); //Default value when there is no saved data. //(*) Activate the "DebugConsole" in the hierarchy to see its parameters. XDebug.Clear(); XDebug.Log("(PlayerPrefs or init)"); XDebug.Log(data, 3); DivisorItem divisorItem = new DivisorItem(1); TextItem textItem = new TextItem("You can make various settings."); TextItem textItem1 = new TextItem("Switch the Party Character"); SwitchItem switchItem = new SwitchItem("UnityChan", "utc", data.utc); SwitchItem switchItem2 = new SwitchItem("PronamaChan", "pronama", data.pronama); SwitchItem switchItem3 = new SwitchItem("QueryChan", "query", data.query); TextItem textItem2 = new TextItem("Select a Servant"); ToggleItem toggleItem = new ToggleItem( new String[] { "Saber", "Rancer", "Caster" }, "servant", new String[] { "saber", "rancer", "caster" }, data.servant); TextItem textItem3 = new TextItem("Sound Setting"); Dictionary <string, int> vols; if (volumeController != null) { vols = volumeController.GetVolumes(); } else { vols = new Dictionary <string, int>() { { "master", 100 }, { "bgm", 50 }, { "voice", 50 }, { "se", 50 } } }; SliderItem sliderItem = new SliderItem("Master", "master", vols["master"], 0, 100, 0, 0, "PreviewVolume"); SliderItem sliderItem1 = new SliderItem("Music", "bgm", vols["bgm"], 0, 100, 0, 0, "PreviewVolume"); SliderItem sliderItem2 = new SliderItem("Voice", "voice", vols["voice"], 0, 100, 0, 0, "PreviewVolume"); SliderItem sliderItem3 = new SliderItem("Effect", "se", vols["se"], 0, 100, 0, 0, "PreviewVolume"); TextItem textItem4 = new TextItem("All saved settings will be deleted when Reset.", Color.red); SwitchItem switchItem4 = new SwitchItem("Reset Setting", "reset", false, Color.blue); DialogItem[] items = new DialogItem[] { textItem, divisorItem, textItem1, switchItem, switchItem2, switchItem3, divisorItem, textItem2, toggleItem, divisorItem, textItem3, sliderItem, sliderItem1, sliderItem2, sliderItem3, divisorItem, switchItem4, textItem4, divisorItem, }; #endif #if UNITY_ANDROID && !UNITY_EDITOR AndroidPlugin.ShowCustomDialog("This is Custom Dialog Demo", "", items, gameObject.name, "OnReceiveResult", true, "Apply", "Cancel"); #endif } else //"key=value" format { #if UNITY_ANDROID //'Param' class is basically the same as Dictionary prepared for easy handling of value type conversion and default value. Param pref = Param.GetPlayerPrefs(gameObject.name, new Param()); //When there is no saved data, it is newly generated (elements are empty). //(*) Activate the "DebugConsole" in the hierarchy to see its parameters. XDebug.Clear(); XDebug.Log("(PlayerPrefs or init)"); XDebug.Log(pref, 3); DivisorItem divisorItem = new DivisorItem(1); TextItem textItem = new TextItem("You can make various settings."); TextItem textItem1 = new TextItem("Switch the Party Character", AndroidColor.WHITE, XColor.ToIntARGB("#ff1493"), "center"); //(*) All color formats are the same (only trying on various tests) SwitchItem switchItem = new SwitchItem("UnityChan", "utc", pref.GetBool("utc", false)); SwitchItem switchItem2 = new SwitchItem("PronamaChan", "pronama", pref.GetBool("pronama", false)); SwitchItem switchItem3 = new SwitchItem("QueryChan", "query", pref.GetBool("query", false)); TextItem textItem2 = new TextItem("Select a Servant", XColor.ToColor("#fff"), XColor.ToColor("0x1e90ff"), "center"); //(*) All color formats are the same (only trying on various tests) ToggleItem toggleItem = new ToggleItem( new String[] { "Saber", "Rancer", "Caster" }, "servant", new String[] { "saber", "rancer", "caster" }, pref.GetString("servant", "saber")); TextItem textItem3 = new TextItem("Sound Setting", XColor.ToIntARGB(Color.white), XColor.ToIntARGB(0x3c, 0xb3, 0x71), "center");//"#3cb371" (*) All color formats are the same (only trying on various tests) Dictionary <string, int> vols; if (volumeController != null) { vols = volumeController.GetVolumes(); } else { vols = new Dictionary <string, int>() { { "master", 100 }, { "bgm", 50 }, { "voice", 50 }, { "se", 50 } } }; SliderItem sliderItem = new SliderItem("Master", "master", vols["master"], 0, 100, 0, 0, "PreviewVolume"); SliderItem sliderItem1 = new SliderItem("Music", "bgm", vols["bgm"], 0, 100, 0, 0, "PreviewVolume"); SliderItem sliderItem2 = new SliderItem("Voice", "voice", vols["voice"], 0, 100, 0, 0, "PreviewVolume"); SliderItem sliderItem3 = new SliderItem("Effect", "se", vols["se"], 0, 100, 0, 0, "PreviewVolume"); TextItem textItem4 = new TextItem("All saved settings will be deleted when Reset.", Color.red); SwitchItem switchItem4 = new SwitchItem("Reset Setting", "reset", false, Color.blue); DialogItem[] items = new DialogItem[] { textItem, divisorItem, textItem1, switchItem, switchItem2, switchItem3, divisorItem, textItem2, toggleItem, divisorItem, textItem3, sliderItem, sliderItem1, sliderItem2, sliderItem3, divisorItem, switchItem4, textItem4, divisorItem, }; #endif #if UNITY_ANDROID && !UNITY_EDITOR AndroidPlugin.ShowCustomDialog("This is Custom Dialog Demo", "", items, gameObject.name, "OnReceiveResult", false, "Apply", "Cancel"); #endif } }
/// <summary> /// 打开对话框 /// </summary> /// <param name="packet"></param> /// <returns></returns> public bool OpenDialogUI(CReadPacket packet) { Debug.Log("OpenDialogUIResult"); Dictionary <string, object> data = packet.data; int resolt = int.Parse(data["ret"].ToString()); if (resolt == 0) { bool isoperation = false; DialogItem dialogitem = new DialogItem(); if (data.ContainsKey("title")) { if (data["title"] == null) { dialogitem.title = ""; } else { dialogitem.title = data["title"].ToString(); } } if (data.ContainsKey("disc")) { dialogitem.disc = data["disc"].ToString(); } if (data.ContainsKey("opt1")) { isoperation = true; dialogitem.opt[0] = data["opt1"].ToString(); dialogitem.opt[1] = data["opt2"].ToString(); dialogitem.opt[2] = data["opt3"].ToString(); dialogitem.opt[3] = data["opt4"].ToString(); if (string.IsNullOrEmpty(dialogitem.opt[0]) && string.IsNullOrEmpty(dialogitem.opt[1]) && string.IsNullOrEmpty(dialogitem.opt[2]) && string.IsNullOrEmpty(dialogitem.opt[3])) { isoperation = false; } } //if (TaskManager.Single().isAcceptTask) //{ // TaskEffectManager.instance.ShowTaskEffect(TaskEffectType.AcceptTask); //} dialogitem.msId = int.Parse(data["msId"].ToString()); dialogitem.scrId = int.Parse(data["scrId"].ToString()); dialogitem.user[0] = int.Parse(data["user1"].ToString());//如果是5010 5020的话 表示闲聊 dialogitem.user[1] = int.Parse(data["user2"].ToString()); dialogitem.user[2] = int.Parse(data["user3"].ToString()); TaskManager.Single().CurrentShowDialogItem = dialogitem; if (isoperation) { //当前npcID 和 移动到npc要触发哪个类型事件 //TaskOperation.Single().MoveToNpc(TaskOperation.Single().taskNpc.NPCID, TaskOperation.MoveToNpcType.OpenTaskList); TaskOperation.Single().MoveToNpc(TaskOperation.Single().currentTaskNpcID, TaskOperation.MoveToNpcType.OpenTaskList); } else { if (dialogitem.user[0] == 5010 || dialogitem.user[0] == 5020) { //TaskOperation.Single().MoveToNpc(TaskOperation.Single().taskNpc.NPCID, TaskOperation.MoveToNpcType.Smalltalk); TaskOperation.Single().MoveToNpc(TaskOperation.Single().currentTaskNpcID, TaskOperation.MoveToNpcType.Smalltalk); } else { //if (TaskOperation.Single() != null && TaskOperation.Single().taskNpc != null) //TaskOperation.Single().MoveToNpc(TaskOperation.Single().taskNpc.NPCID, TaskOperation.MoveToNpcType.OpenChatDialog); if (TaskOperation.Single() != null && TaskOperation.Single().currentTaskNpcID != 0) { TaskOperation.Single().MoveToNpc(TaskOperation.Single().currentTaskNpcID, TaskOperation.MoveToNpcType.OpenChatDialog); } } } } else { Debug.Log(data["desc"].ToString()); } return(true); }