void Start() { ConText context = new ConText(); context.SetState(new ConcreteStateA(context)); context.Handle(5); context.Handle(20); context.Handle(30); context.Handle(4); }
public void displayText(string key, int index, int MinIndex, int MaxIndex, _UnityEventStringArr[] methods) { if ((key != currentKey && inConversation) || currentIndex < MinIndex || currentIndex > MaxIndex) { return; } inConversation = true; conPanelAnim.SetBool("isOpen", true); currentIndex = index; currentKey = key; if (methods != null) { currentMethods = methods; } ConText[] conver = LocalizationManager.instance.GetConText(key); if (conver != null && conver.Length >= index) { currentMessage = conver[index]; } else { currentMessage = new ConText(); currentMessage.doSomething = false; currentMessage.end = true; currentMessage.name = "<color=\"red\" > error"; currentMessage.parameters = new string[0]; currentMessage.skipable = true; currentMessage.spriteKey = "error"; currentMessage.theText = "<color=\"red\" > error"; } //print(message.name + " says: " + message.theText); image.sprite = sprites[currentMessage.spriteKey]; nameText.text = currentMessage.name; text.text = ""; if (coroutine != null) { StopCoroutine(coroutine); } coroutine = typetext(currentMessage.theText, text, textSpeed); StartCoroutine(coroutine); if (currentMessage.end == true) { inConversation = false; currentIndex = -1; currentKey = ""; } }
public ConcreteStateB(ConText context) { mContext = context; }