public void Add(Transform target, PhraseSequence phrase) { Remove(target); var instance = GameObjectUtil.GetResourceInstanceFromAttribute<SpeechBubble2D>(); instance.Initialize(target, phrase); instances[target] = instance; }
void SetValue(SerializedProperty property) { var obj = property.serializedObject.targetObject.GetType().GetField(property.name); var sps = obj.GetValue(property.serializedObject.targetObject) as ScenePhraseSequence; sps.Set(phrase); EditorUtility.SetDirty(property.serializedObject.targetObject); phrase = null; }
public int GetPhraseProgressionStep(PhraseSequence phrase) { var p = GetPhraseProgression(phrase); if (p == null) { return 0; } return p.Step; }
public SpeechBubbleRequestedEventArgs(Transform target, PhraseSequence phrase, bool reduceConfidence, Action <GameObject> callback) { Target = target; Phrase = phrase; ReduceConfidence = reduceConfidence; SpeechBubblePointerType = PointerType.Normal; this.Callback = callback; }
public TriggerData2D() { Guid = Guid.NewGuid(); Name = new PhraseSequence(); Size = 1; Orientation = 0; Position = Vector2.zero; }
public PhraseConstructorArgs(PhraseSequence phrase, List <PhraseSequence> availableWords) { this.Phrase = phrase; this.AvailableWords = availableWords; this.Help = "Say \"" + PlayerDataConnector.GetTranslation(phrase) + "\""; this.Context = new ContextData(); this.EmptySlots = phrase.ComparableElementCount; }
public PhraseConstructorArgs(PhraseSequence phrase, List<PhraseSequence> availableWords) { this.Phrase = phrase; this.AvailableWords = availableWords; this.Help = "Say \"" + PlayerDataConnector.GetTranslation(phrase) + "\""; this.Context = new ContextData(); this.EmptySlots = phrase.ComparableElementCount; }
public SpeechBubbleRequestedEventArgs(Transform target, PhraseSequence phrase, bool reduceConfidence, Action<GameObject> callback) { Target = target; Phrase = phrase; ReduceConfidence = reduceConfidence; SpeechBubblePointerType = PointerType.Normal; this.Callback = callback; }
public void Initialize(Transform target, PhraseSequence phrase) { this.target = target; var go = Instantiate<GameObject>(draggablePhrasePrefab); go.GetComponent<IInitializable<PhraseSequence>>().Initialize(phrase); go.transform.SetParent(phraseParent, false); MainCanvas.main.Add(transform); }
public PhraseEventArgs(IWordContainer phraseContainer) { //PhraseData = phraseContainer.PhraseData; PhraseContainer = phraseContainer; Phrase = new PhraseSequence(); Phrase.Add(phraseContainer.Word); //PhraseData.GetPhraseSequence().PhraseElements[0]); }
public bool ContainsPhrase(PhraseSequence phrase) { foreach (var p in Phrases) { if (PhraseSequence.PhrasesEquivalent(p, phrase)) { return true; } } return false; }
public PhraseProgressionPlayerData GetPhraseProgression(PhraseSequence phrase) { foreach (var p in PhraseProgressions) { if (PhraseSequence.PhrasesEquivalent(p.Phrase, phrase)) { return p; } } return null; }
void AddWord(PhraseSequence word) { words.Add(word.Word); var instance = Instantiate<GameObject>(wordPrefab); instance.GetInterface<IInitializable<PhraseSequence>>().Initialize(word); instance.transform.SetParent(wordParent, false); wordInstances.Add(instance); offset = 0; }
GameObject GenerateWordChild(PhraseSequence phrase) { var instance = Instantiate<GameObject>(popupPrefab); instance.transform.Find("NumberText").GetComponent<Text>().text = childCount + ":"; phrases[childCount.ToString()[0]] = phrase; childCount++; instance.GetInterface<IInitializable<PhraseSequence>>().Initialize(phrase); return instance; }
public void SetPhraseProgressionInteraction(PhraseSequence phrase, int globalID) { var p = GetPhraseProgression(phrase); if (p == null) { p = new PhraseProgressionPlayerData(); p.Phrase = phrase; PhraseProgressions.Add(p); } p.AddActor(globalID); }
public override void Initialize(PhraseSequence phrase) { base.Initialize(phrase); GetComponentInChildren<Text>().text = PlayerDataConnector.GetText(phrase); if (PlayerDataConnector.CanLearn(phrase)) { GetComponent<Image>().enabled = true; } else { GetComponent<Image>().enabled = false; } }
public ContextDataElement(string id, PhraseSequence data) : this(id) { Data = data; foreach (var e in data.PhraseElements) { if (!e.Tags.Contains(id)) { e.Tags.Add(id); } } }
public void Set(string id, PhraseSequence value) { var e = Get(id); if (e != null) { e.Data = value; } else { e = new ContextDataElement(id); e.Data = value; Elements.Add(e); } }
public void Add(Transform target, PhraseSequence phrase) { if (names.ContainsKey(target)) { GameObject.Destroy(names[target].gameObject); names.Remove(target); } var instance = GameObjectUtil.GetResourceInstanceFromAttribute<FloatingName2D>(); instance.Initialize(target); instance.Initialize(phrase); names[target] = instance; }
public static GameObject Click(PhraseSequence phrase, Vector2 position, bool isWord) { var prefab = Settings.draggedPhrasePrefab; if (isWord) { prefab = Settings.draggedWordPrefab; } var instance = GameObject.Instantiate(prefab); instance.AddComponent<DraggedPhrase>().Initialize(phrase, position); instance.GetOrAddComponent<CanvasGroup>().interactable = false; instance.GetOrAddComponent<CanvasGroup>().blocksRaycasts = false; return instance; }
public void SetElement(int index, PhraseSequence word) { if (index < 0) { throw new System.IndexOutOfRangeException("Word index must be greater than 0"); } while (Words.Count <= index) { Words.Add(null); } Words[index] = word; RaiseDataChanged(); }
public void Display(PhraseSequence phrase) { open = true; GetComponentInChildren<Text>().text = PlayerDataConnector.GetText(phrase); //GetComponentInChildren<Text>().text = PlayerDataConnector.GetText(phrase); if (phraseInstance) { Destroy(phraseInstance); } phraseInstance = Instantiate(phrasePrefab); phraseInstance.GetInterface<IInitializable<PhraseSequence>>().Initialize(phrase); phraseInstance.transform.SetParent(transform, false); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { EditorGUI.BeginProperty(position, label, property); var obj = property.serializedObject.targetObject.GetType().GetField(property.name); var sps = obj.GetValue(property.serializedObject.targetObject) as ScenePhraseSequence; if (sps.CachedText == null) { sps.CachedText = sps.Get().GetText(); } if (GUI.Button(position, sps.CachedText)) { if (Event.current.button == 0) { phrase = sps.Get(); PhraseEditorWindow.Open(phrase, () => SetValue(property)); } else { phrase = sps.Get(); PhraseTranslatorEditorWindow.Open(phrase, () => SetValue(property)); } } EditorGUI.EndProperty(); }
public PartnerSaidPhraseEventArgs(string guid, PhraseSequence phrase) { this.PlayerGuid = guid; this.Phrase = phrase; }
public DragDropFreeInputUIRequestEventArgs(GameObject menuParent, PhraseSequence phrase) : base(menuParent) { Phrase = phrase; }
public static PhraseSequence GetComparableSubset(this PhraseSequence p) { var comparables = from elem in p.PhraseElements where elem.Comparable select elem; PhraseSequence phrase = new PhraseSequence(); phrase.Translation = p.Translation; foreach (var e in comparables) { phrase.Add(e); } return phrase; }
public static PhraseSequence Flatten(this IEnumerable<PhraseSequence> phrases) { var p = new PhraseSequence(); foreach (var w in phrases) { p.Add(w); } return p; }
public PhraseInputEventArgs(PhraseSequence phrase, ContextData context) : this(phrase) { Phrase = phrase; ContextData = context; }
public static GameObject Click(PhraseSequence phrase, Vector2 position) { return Click(phrase, position, phrase.IsWord); }
public PhraseSequence(PhraseSequence original) { Translation = original.Translation; PhraseElements = new List<PhraseSequenceElement>(original.PhraseElements); }
string HelperGetTranslation(PhraseSequence sequence) { var t = ""; if (sequence.IsWord) { t = sequence.Word.GetTranslation(); } else { t = sequence.Translation; } return t; }
public PhraseConstructorArgs(PhraseSequence phrase, List <PhraseSequence> availableWords, int emptySlots) : this(phrase, availableWords) { this.EmptySlots = Mathf.Clamp(emptySlots, 0, phrase.ComparableElementCount); }
public PhraseConstructorArgs(PhraseSequence phrase, List <PhraseSequence> availableWords, string help) : this(phrase, availableWords) { this.Help = help; }
public BookmarkChangedEventArgs(PhraseSequence bookmarkedPhrase) { Phrase = bookmarkedPhrase; }
public PhraseInputEventArgs(PhraseSequence phrase) { Phrase = phrase; }
public static GameObject BeginDrag(PhraseSequence phrase, Vector2 position) { return BeginDrag(phrase, position, phrase.IsWord); }
public static void AddValidWords(this HashSet<PhraseSequenceElement> set, PhraseSequence phrase) { if (phrase.IsWord && phrase.Word.IsDictionaryWord) { set.Add(phrase.Word); } else { foreach (var elem in phrase.GetElements()) { if (elem.IsDictionaryWord) { set.Add(elem); } } } }
public static bool ContainsEquivalentPhrase(this IEnumerable<PhraseSequence> phrases, PhraseSequence phrase, out PhraseSequence item) { foreach (var p in phrases) { if (PhraseSequence.PhrasesEquivalent(phrase, p)) { item = p; return true; } } item = null; return false; }