예제 #1
0
    //注意,进入恋爱进入剧情也需要有后退键
    public override void OnMessage(Message message)
    {
        string name = message.Name;

        object[]   body  = message.Params;
        StoryModel model = RegisterModel <StoryModel>();

        switch (name)
        {
        case MessageConst.CMD_STORY_READY:
            if (model.StoryType == StoryType.MainStory)
            {
                _storyPanel.ShowBackBtn();
                _storyPanel.NeedToHideSkip(true);
            }
            else if (model.StoryType == StoryType.Visit)
            {
                _storyPanel.ShowBackBtn();
                _storyPanel.NeedToHideSkip(true);
            }
            else if (model.StoryType == StoryType.LoveAppointment)
            {
                _storyPanel.ShowBackBtn();

                _storyPanel.NeedToHideSkip(AppConfig.Instance.isTestMode);
#if UNITY_EDITOR
                _storyPanel.NeedToHideSkip(true);
#endif
                if (!GuideManager.IsPass1_9())
                {
                    _storyPanel.NeedToHideSkip(true);
                }
            }
            else if (model.StoryType == StoryType.ActivityCapsule)
            {
                _storyPanel.NeedToHideSkip(true);
                _storyPanel.ShowBackBtn();
            }
            else if (model.StoryType == StoryType.CreateUser)
            {
                _storyPanel.NeedToHideSkip(false);
                _storyPanel.HideAllBtn();
            }

            break;

        case MessageConst.MODULE_STORY_SHOW_RECORD_VIEW:
            _storyRecordWindow = PopupManager.ShowWindow <StoryRecordWindow>("Story/Prefabs/StoryRecordWindow");
            _storyRecordWindow.SetData(model.GetCurrentDialog());
            break;

        case MessageConst.CMD_STORY_RECODE_DIALOG:
            model.AddDialog(body[0], (string)body[1]);
            break;

        case MessageConst.CMD_STORY_ON_EVENT:
            EventType eventType  = (EventType)body[0];
            string    eventId    = (string)body[1];
            bool      isAutoPlay = (bool)body[2];

            HideAllPanel();

            if (eventType == EventType.Telephone)
            {
                if (_storyTelephonePanel == null)
                {
                    _storyTelephonePanel = new StoryTelephonePanel();
                    _storyTelephonePanel.Init(this);
                }
                _storyTelephonePanel.Show(isAutoPlay);
                _storyTelephonePanel.LoadJson(eventId, _currentPanel != _storyTelephonePanel);

                _currentPanel = _storyTelephonePanel;
            }
            else if (eventType == EventType.Story)
            {
                _storyPanel.Show(isAutoPlay);

                SendMessage(new Message(MessageConst.CMD_STORY_BRANCH_SELECTED,
                                        Message.MessageReciverType.CONTROLLER, eventId));

                _currentPanel = _storyPanel;
            }
            else if (eventType == EventType.Sms)
            {
                if (_storySmsPanel == null)
                {
                    _storySmsPanel = new StorySmsPanel();
                    _storySmsPanel.Init(this);
                }
                _storySmsPanel.Show(isAutoPlay);
                _storySmsPanel.LoadJson(eventId, _currentPanel != _storySmsPanel);

                _currentPanel = _storySmsPanel;
            }
            break;
        }
    }