static T CreateWordEffect <T, U>(U effectData) where T : WordEffect where U : WordEffectData { if (typeof(T).Equals(typeof(TypeWriterEffect))) { TypeWriterEffect effect = new TypeWriterEffect(); effect.ConstructWordEffect(effectData); return((T)(object)effect); } else if (typeof(T).Equals(typeof(InstantDisplayAfterDurationEffect))) { InstantDisplayAfterDurationEffect effect = new InstantDisplayAfterDurationEffect(); effect.ConstructWordEffect(effectData); return((T)(object)effect); } else if (typeof(T).Equals(typeof(VibrationEffect))) { VibrationEffect effect = new VibrationEffect(); effect.ConstructWordEffect(effectData); return((T)(object)effect); } else { throw new Exception("try to create unimplemented word effect"); } }
private void InitRef() { _formulaName = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(m_dialog.ManuContent, "Name")); _timeText = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(m_dialog.ManuContent, "Time")); _formulaContentCmpt = UIUtility.SafeGetComponent <FormulaContentCmpt>(UIUtility.FindTransfrom(m_dialog.ManuContent, "FormulaContent")); _desc = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(m_dialog.ManuContent, "Desc")); _loopList = UIUtility.SafeGetComponent <LoopList>(m_dialog.ScrollViewTrans); typeWriter = UIUtility.SafeGetComponent <TypeWriterEffect>(_desc.transform); }
static List <WordEffect> CreateWordEffects(string line, Word ownerWord) { List <WordEffect> createdWordEffect = new List <WordEffect>(); //用|来分割关键字段 List <string> phrases = new List <string>(line.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries)); foreach (string phrase in phrases) { if (phrase.Contains("<")) { char[] phraseCharArr = phrase.ToCharArray(); for (int i = 0; i < phraseCharArr.Length; ++i) { char ch = phraseCharArr[i]; if (i == 0 && ch != '<') { throw new Exception(string.Format("Wrong line {0}", phrase)); } if (i == 1) { switch (ch) { case 'T': TypeWriterEffectData data = new TypeWriterEffectData(phrase); TypeWriterEffect typeWriterEffect = CreateWordEffect <TypeWriterEffect, TypeWriterEffectData>(data); createdWordEffect.Add(typeWriterEffect); break; } } } foreach (char ch in phraseCharArr) { } if (phraseCharArr[0] != '<') { } char typeC = phraseCharArr[1]; } else { //default we use TypeWriterEffect TypeWriterEffectData data = new TypeWriterEffectData(phrase); TypeWriterEffect typeWriterEffect = CreateWordEffect <TypeWriterEffect, TypeWriterEffectData>(data); createdWordEffect.Add(typeWriterEffect); } } return(createdWordEffect); }
private void InitRef() { _techNameText = Transform.FindTransfrom("Content/Context/Name").SafeGetComponent <Text>(); _techIcon = Transform.FindTransfrom("Content/Context/Slot/Icon").SafeGetComponent <Image>(); _techCost = Transform.FindTransfrom("Content/Context/Detail/Cost/Value").SafeGetComponent <Text>(); _techTimeCost = Transform.FindTransfrom("Content/Context/Detail/Time/Value").SafeGetComponent <Text>(); _techDesc = Transform.FindTransfrom("Desc").SafeGetComponent <Text>(); _confirmBtnText = Transform.FindTransfrom("Content/ButtonGeneral/Text").SafeGetComponent <Text>(); descTypewriterEffect = Transform.FindTransfrom("Content/Context/Desc").SafeGetComponent <TypeWriterEffect>(); _rarityImage = Transform.FindTransfrom("Content/Context/Slot/Rarity").SafeGetComponent <Image>(); }
void Start() { player = GameObject.Find("Character"); dialogueManager = GameObject.Find("DialogueManager"); showText = false; playerCollision = player.GetComponent <PlayerMovement>(); dialogueText = dialogueManager.GetComponent <TypeWriterEffect>(); animateID = Animator.StringToHash("shouldAnimate"); anim = GetComponent <Animator>(); }
void InitRef() { _anim = UIUtility.SafeGetComponent <Animation>(Transform); _blockIcon = UIUtility.SafeGetComponent <Image>(UIUtility.FindTransfrom(m_page.Title, "Icon")); _blockName = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(m_page.Title, "Name")); _districtMaxText = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(m_page.LeftPanel, "Value")); _desc = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(m_page.RightPanel, "Desc")); _typeEffect = UIUtility.SafeGetComponent <TypeWriterEffect>(UIUtility.FindTransfrom(m_page.RightPanel, "Desc")); _gridContentTrans = UIUtility.FindTransfrom(m_page.LeftPanel, "GridContent"); _buildCostContentTrans = UIUtility.FindTransfrom(m_page.RightPanel, "Content"); _timeCost = UIUtility.SafeGetComponent <Text>(UIUtility.FindTransfrom(m_page.RightPanel, "TimeCost/Value")); }
/* Tries to grab the next text within the narration text */ public void GetNextText() { Transform myObject = null; if (myTextObjectsQueue.Count != 0) //Change the current node { myObject = myTextObjectsQueue.Dequeue(); } currentNode = myObject; if (myObject != null) //Change the current effect { currentEffect = null; currentEffect = currentNode.gameObject.GetComponent <TypeWriterEffect> (); } }
void Start() { fadeImage = GameObject.Find("FadeSpawner").GetComponent <FadeImage>(); box = GameObject.Find("Canvas").transform.GetChild(0).gameObject; twe = box.GetComponent <TypeWriterEffect>(); }