Пример #1
0
 void StoryDirector.IStoryEventReceiver.AddMessage(string name, string msg, StoryDirector.POS tail_dir, StoryDirector.MSG_TYPE msg_type)
 {
     if (!(this == null))
     {
         addMessageFunc = delegate
         {
             AddMessage(name, msg, tail_dir, msg_type);
         };
     }
 }
Пример #2
0
    private IEnumerator DoAddMessage(string name, string msg, StoryDirector.POS tail_dir, StoryDirector.MSG_TYPE msg_type)
    {
        typewriter = null;
        Transform table_t     = GetCtrl(UI.TBL_MESSAGE);
        string    prefab_name = "StoryMessageItem0";

        if (msg_type == StoryDirector.MSG_TYPE.MONOLOGUE)
        {
            prefab_name = "StoryMessageItem1";
        }
        Transform message_item_t = Realizes(prefab_name, table_t, true);

        message_item_t.SetSiblingIndex(0);
        UIWidget message_item_w = message_item_t.GetComponent <UIWidget>();

        lastMessageItem   = message_item_t;
        balloon           = base.GetComponent <UISprite>(message_item_t, (Enum)UI.SPR_BALLOON);
        tailLeft          = FindCtrl(message_item_t, UI.SPR_TAIL_L);
        tailRight         = FindCtrl(message_item_t, UI.SPR_TAIL_R);
        tailCenter        = FindCtrl(message_item_t, UI.SPR_TAIL_C);
        nameLabel         = base.GetComponent <UILabel>(message_item_t, (Enum)UI.LBL_NAME);
        messageLabel      = base.GetComponent <UILabel>(message_item_t, (Enum)UI.LBL_MESSAGE);
        initBaseHeight    = message_item_w.height;
        messageLabel.text = " ";
        initMessageHeight = messageLabel.height;
        messageHeight     = initMessageHeight;
        string temp = string.Empty;

        if (messageLabel.Wrap(msg, out temp))
        {
            msg = WordWrap.Convert(messageLabel, msg);
        }
        SetLastMessageFocus(true);
        SetMessageDragEnabled(false);
        if (msg_type == StoryDirector.MSG_TYPE.NORMAL)
        {
            if (tailLeft != null && tail_dir != StoryDirector.POS.LEFT)
            {
                tailLeft.get_gameObject().SetActive(false);
            }
            if (tailRight != null && tail_dir != StoryDirector.POS.RIGHT)
            {
                tailRight.get_gameObject().SetActive(false);
            }
            if (tailCenter != null && tail_dir != StoryDirector.POS.CENTER)
            {
                tailCenter.get_gameObject().SetActive(false);
            }
            nameLabel.text = name;
        }
        UIWidget next_arrow_w = base.GetComponent <UIWidget>((Enum)UI.SPR_NEXT);

        next_arrow_w.get_gameObject().SetActive(false);
        List <UITweener> tweens = new List <UITweener>();

        message_item_t.GetComponentsInChildren <UITweener>(tweens);
        while (tweens.Find((UITweener o) => o.get_enabled()) != null)
        {
            yield return((object)null);
        }
        SoundManager.PlaySystemSE(SoundID.UISE.POPUP, 1f);
        messageLabel.text         = msg;
        typewriter                = messageLabel.get_gameObject().AddComponent <TypewriterEffect>();
        typewriter.charsPerSecond = StoryDirector.SPEED_TYPEWRITER;
        typewriter.ResetToBeginning();
        while (typewriter.isActive)
        {
            yield return((object)null);
        }
        yield return((object)null);

        next_arrow_w.get_gameObject().SetActive(true);
        Vector3[] message_corners    = message_item_w.worldCorners;
        Vector3[] next_arrow_corners = next_arrow_w.worldCorners;
        ((UIRect)next_arrow_w).SetAnchor(null);
        next_arrow_w.cachedTransform.set_position(new Vector3((next_arrow_corners[0].x + next_arrow_corners[2].x) * 0.5f, message_corners[0].y - (next_arrow_corners[1].y - next_arrow_corners[0].y) * 0.5f, next_arrow_corners[0].z));
        SetMessageDragEnabled(true);
        Object.Destroy(typewriter);
        typewriter    = null;
        messageHeight = 0;
        messageNum++;
        coroutine = null;
    }
Пример #3
0
 public void AddMessage(string name, string msg, StoryDirector.POS tail_dir, StoryDirector.MSG_TYPE msg_type)
 {
     //IL_0015: Unknown result type (might be due to invalid IL or missing references)
     this.StartCoroutine(coroutine = DoAddMessage(name, msg, tail_dir, msg_type));
 }