Beispiel #1
0
 public void LoadSkybox(SkyboxEnum skyboxEnum)
 {
     m_actions.Enqueue(new StoryLoadSkyboxAction()
     {
         Type = StoryActionType.LoadSkybox, m_skyEnum = skyboxEnum
     });
 }
    public void UpdateSkybox(SkyboxEnum skyEnum)
    {
        Debug.Log("Update Skybox:  " + skyEnum);

        if (skyEnum == SkyboxEnum.None)
        {
            RevertSkybox();
            return;
        }

        foreach (var item in m_skyboxs)
        {
            if (skyEnum == item.m_skyboxEnum)
            {
                m_currentSkyboxEnum         = item.m_skyboxEnum;
                RenderSettings.skybox       = item.m_material;
                RenderSettings.ambientLight = item.m_environmentColor;
                DynamicGI.UpdateEnvironment();

                return;
            }
        }
        Debug.LogWarning("no sky materials");

        //m_skyboxs.TryGetValue(skyEnum, out var skyboxMaterial);
        //if (skyboxMaterial)
        //{
        //    m_currentSkybox = skyEnum;
        //    RenderSettings.skybox = skyboxMaterial;
        //    DynamicGI.UpdateEnvironment();
        //}
        //else
        //{
        //    Debug.LogWarning("no sky materials");
        //}

        //if (skyEnum == SkyboxEnum.None)
        //{
        //    RevertSkybox();
        //}
    }
        public StoryActionContainer GetStory(string labelId)
        {
            StoryActionContainer container = new StoryActionContainer();

            StoryVirtualMachine.Instance.SetStoryActionContainer(container);
            if (m_storys == null)
            {
                Debug.LogError("Story doesn`t exist.");
                return(null);
            }
            if (!m_storys.RequestLabel(labelId))
            {
                Debug.LogError($"Label {labelId} doesn`t exist");
            }
            else
            {
                m_storys.JumpToWordAfterLabel(labelId);
            }

            if (!IsLabelRead(labelId))
            {
                AddReadLabel(labelId);
            }

            //            container.PushChangePanelType(1);
            //            container.PushJump(new List<Option>(){new Option("1","这是一个不知道什么内容的选项"),new Option("2","这是一个不知道什么内容的选项")});
            //            container.PushFrontImg("MG_TalkType1_TalkBGVignetee");
            while (!m_storys.IsDone())
            {
                switch (m_storys.GetNodeType())
                {
                case StoryReader.NodeType.word:
                    container.PushName(m_storys.GetName());
                    StoryVirtualMachine.Instance.Run(m_storys.GetContent());
                    m_storys.NextStory();
                    break;

                case StoryReader.NodeType.jump:
                    container.PushJump(m_storys.GetJump());
                    //						m_storys.NextStory ();
                    //Test
                    return(container);

                    break;

                case StoryReader.NodeType.label:
                    //m_storys.NextStory ();
                    m_storys.NextStory();
                    break;

                case StoryReader.NodeType.end:
                    m_storys.NextStory();
                    return(container);

                    break;

                case StoryReader.NodeType.exhibit:
                    container.PushShowEvidence(m_storys.GetExhibit(), m_storys.GetExhibitPrefix());
                    m_storys.NextStory();
                    //return container;
                    break;

                case StoryReader.NodeType.raiseEvent:
                    string eventName = m_storys.GetEventName();

                    switch (m_storys.GetEventType())
                    {
                    case StoryReader.EventType.loadScene:
                        container.PushLoadGameScene(eventName);
                        break;

                    case StoryReader.EventType.loadMission:
                    {
                        MissionEnum needLoadMission = MissionSceneManager.Instance.GetMissionEnumBy(eventName, false);
                        if (needLoadMission == MissionEnum.None)
                        {
                            Debug.LogError(eventName + " is not exist.");
                        }
                        container.LoadMission(needLoadMission);
                        //m_storys.NextStory();
                        //return container;
                    }
                    break;

                    case StoryReader.EventType.LoadCgScene:
                        container.LoadCGScene(eventName);
                        break;

                    case StoryReader.EventType.CloseCgScene:
                        container.CloseCGScene(eventName);
                        break;

                    case StoryReader.EventType.LoadControversy:
                        container.PushEnterControversy(eventName);
                        break;

                    case StoryReader.EventType.PlayCutIn:
                        container.PushCutIn(eventName);
                        break;

                    case StoryReader.EventType.PlayInteractionAnimation:
                        string cleanItemName = eventName;
                        if (cleanItemName.Contains("_"))
                        {
                            cleanItemName = eventName.Substring(0, eventName.IndexOf('_'));
                        }
                        container.PlayInteractionAnimation(cleanItemName);
                        break;

                    case StoryReader.EventType.invokeEvent:
                        container.TriggerEvent(new StarPlatinum.EventManager.RaiseEvent(
                                                   StoryReader.EventType.invokeEvent,
                                                   eventName));
                        break;

                    case StoryReader.EventType.playAnimation:
                        container.PlayAnimation(eventName);
                        break;

                    case StoryReader.EventType.PlayTimeline:
                        container.PushTimeLine(eventName);
                        break;

                    case StoryReader.EventType.LoadFrontground:
                        container.PushFrontImg(eventName);
                        break;

                    case StoryReader.EventType.LoadBackground:
                        container.ChangeBackground(eventName);
                        break;

                    case StoryReader.EventType.LoadSkybox:
                        SkyboxEnum skyboxEnum = (SkyboxEnum)Enum.Parse(typeof(SkyboxEnum), eventName);
                        container.LoadSkybox(skyboxEnum);
                        break;

                    case StoryReader.EventType.SwitchTalkUIType:
                        int UIPanelType = int.Parse(eventName);
                        container.PushChangePanelType(UIPanelType);
                        break;

                    case StoryReader.EventType.RemoveSpecificExhibit:
                        container.PushRemoveEvidence(eventName);
                        break;

                    case StoryReader.EventType.RemoveAllExhibit:
                        container.RemoveAllExhibit();
                        break;

                    case StoryReader.EventType.GameOver:
                        container.PushGameEvent("GameEnd");
                        break;

                    default:
                        break;
                    }
                    m_storys.NextStory();
                    break;

                default:
                    Debug.LogError("Unknown Node Type");
                    break;
                }
            }
            return(container);
        }