public winDialogStory(string name, string caption, DialogStory story, Action<winDialogStory> OnCloseCallback) : base(name, new GUIContent(caption)) { _questHintStyle = new GUIStyle(); _questHintStyle.normal.background = ResourceManager.Instance.LoadTexture2D("GUI/NPC/exclamation"); _questButtonStyle = new GUIStyle(); _questButtonStyle.normal.background = ResourceManager.Instance.LoadTexture2D("GUI/Skins/button_quest"); _questButtonStyle.hover.background = ResourceManager.Instance.LoadTexture2D("GUI/Skins/button_quest_hover"); _questButtonStyle.active.background = ResourceManager.Instance.LoadTexture2D("GUI/Skins/button_quest_active"); _questButtonStyle.font = ResourceManager.Instance.LoadFont(ResourceManager.FontComicSerif); _questButtonStyle.fontSize = 15; _questButtonStyle.normal.textColor = new Color(0.73f, 0.96f, 1f, 1f); _questButtonStyle.hover.textColor = Color.white; _questButtonStyle.alignment = TextAnchor.MiddleCenter; Story = story; IsDraggable = true; TweenDirection = WindowTweenDirection.FromTop; Initalize(name, caption, story, OnCloseCallback); Margin = new Rect(Margin.x, 30, Margin.width, Margin.height); MakeCenter(400, 300); _actions.Clear(); _actions.Add(QuestStateType.None, DisplayQuestPassiveState); _actions.Add(QuestStateType.Normal, DisplayQuestNormalState); _actions.Add(QuestStateType.Active, DisplayQuestActiveState); _actions.Add(QuestStateType.Done, DisplayQuestDoneState); }
/// <summary> /// Serialize a DialogStory into JSON string /// </summary> /// <param name="story">The Dialog Story</param> /// <returns>JSON string</returns> public static string SerializeToJSON(DialogStory story) { string result = null; try { result = JsonMapper.ToJson(story); //TODOCHECK //result = JsonConvert.SerializeObject(story); } catch (Exception) { result = null; } return result; }
public static winDialogStory CreateDialogStory(string name, string caption, DialogStory story, Action<winDialogStory> OnCloseCallback) { winDialogStory dlg = null; if (Windows.ContainsKey(name)) { dlg = (winDialogStory)Windows[name]; dlg.Initalize(name, caption, story, OnCloseCallback); dlg.Show(); } else { dlg = new winDialogStory(name, caption, story, OnCloseCallback); Windows.Add(name, dlg); } return dlg; }
public static IEnumerable<int> GetEmbeddedQuests(DialogStory story) { List<int> result = new List<int>(); if (story.Dialogs.Count < 1) { return result; } foreach (Dialog dialog in story.Dialogs) { foreach (DialogOption option in dialog.Options) { if (option.Tipe == DIALOG_OPTION_QUEST && option.Next > -1) { result.Add(option.Next); } } } return result; }
public void Initalize(string name, string caption, DialogStory story, Action<winDialogStory> OnCloseCallback) { Name = name; Caption = new GUIContent(caption); Story = story; Story.CurrentDialog = 0; closeCallback = OnCloseCallback; }