コード例 #1
0
 public void CheckNextMove(DramaAction thisAction)
 {
     thisAction.FinishCurrentAction();
     if (thisAction.actionFinish)
     {
         NextFrame();
         return;
     }
 }
コード例 #2
0
 public void CheckNextMove(BaseToolBehavior thisTool, DramaAction thisAction)
 {
     thisAction.FinishCurrentAction();
     if (thisAction.actionFinish)
     {
         NextFrame();
         return;
     }
     thisTool.OrderMovement(thisAction.actorsPosition[thisAction.actorPositionIdx], () => CheckNextMove(thisTool, thisAction));
 }
コード例 #3
0
        public void CheckNextMove(BaseCharacter thisCharacter, DramaAction thisAction)
        {
            thisAction.FinishCurrentAction();
            if (thisAction.actionFinish)
            {
                NextFrame();
                return;
            }
            ScenePointBehavior tmp = ScenePointPathfinder.GetInstance.ObtainNearestScenePoint(thisAction.actorsPosition[thisAction.actorPositionIdx]);

            thisCharacter.OrderMovement(tmp, () => CheckNextMove(thisCharacter, thisAction));
            thisCharacter.OrderToFace((FacingDirection)thisAction.facingDirection[thisAction.actorPositionIdx]);
            thisCharacter.UpdateCharacterState(thisAction.characterStates[thisAction.actorPositionIdx]);
        }
コード例 #4
0
        IEnumerator DelayThisAction(DramaAction thisAction, float delayTime)
        {
            yield return(new WaitForSeconds(delayTime));

            EnactAction(thisAction);
        }
コード例 #5
0
        public void EnactAction(DramaAction thisAction)
        {
            if (thisAction.delayBeforeStart > 0.0f)
            {
                float time = new float();
                time = thisAction.delayBeforeStart;
                thisAction.delayBeforeStart = 0;
                StartCoroutine(DelayThisAction(thisAction, time));
            }
            else
            {
                // Check if Actor Exist
                if (thisAction.actionType == DramaActionType.MakeActorMove)
                {
                    if (thisAction.thisActor.actorType != DramaActorType.SFX && thisAction.thisActor.actorType != DramaActorType.Tools)
                    {
                        //Debug.Log("Making Actor Move!");
                        GameObject actionActor = thisAction.thisActor.currentActor;

                        if (actionActor.GetComponent <BaseCharacter>() == null)
                        {
                            return;
                        }

                        BaseCharacter thisChar = actionActor.GetComponent <BaseCharacter>();
                        if (thisAction.stayOnLastState)
                        {
                            thisChar.isActing = true;
                        }
                        else
                        {
                            thisChar.isActing = false;
                        }

                        if (thisChar == null)
                        {
                            // Debug.LogError("BaseCharacter Not Found, Check Unit");
                            return;
                        }

                        if (ScenePointPathfinder.GetInstance == null)
                        {
                            //  Debug.LogError("Need ScenePoint PathFinder");
                            return;
                        }

                        if (thisAction.actorPositionIdx == 0)
                        {
                            ScenePointBehavior tmp = ScenePointPathfinder.GetInstance.ObtainNearestScenePoint(thisAction.actorsPosition[0]);
                            thisChar.SpawnInThisPosition(tmp);
                            CheckNextMove(thisChar, thisAction);
                            thisChar.OrderToFace((FacingDirection)thisAction.facingDirection[thisAction.actorPositionIdx]);
                        }
                        else
                        {
                            ScenePointBehavior tmp = ScenePointPathfinder.GetInstance.ObtainNearestScenePoint(thisAction.actorsPosition[1]);
                            thisChar.OrderMovement(tmp, () => CheckNextMove(thisChar, thisAction));
                            thisChar.OrderToFace((FacingDirection)thisAction.facingDirection[thisAction.actorPositionIdx]);
                        }
                    }
                    else if (thisAction.thisActor.actorType == DramaActorType.Tools)
                    {
                        BaseToolBehavior tmp = thisAction.thisActor.currentActor.GetComponent <BaseToolBehavior>();

                        if (tmp == null)
                        {
                            return;
                        }

                        if (thisAction.actorPositionIdx == 0)
                        {
                            tmp.OrderMovement(thisAction.actorsPosition[0], () => CheckNextMove(tmp, thisAction));
                        }
                    }
                }
                else if (thisAction.actionType == DramaActionType.BanishActor)
                {
                    GameObject actionActor = thisAction.thisActor.currentActor;

                    if (actionActor.GetComponent <BaseCharacter>() == null)
                    {
                        return;
                    }

                    BaseCharacter thisChar = actionActor.GetComponent <BaseCharacter>();

                    thisChar.OrderToBanish();
                    CheckNextMove(thisAction);
                }
                else if (thisAction.actionType == DramaActionType.ShowActor)
                {
                    GameObject actionActor = thisAction.thisActor.currentActor;

                    if (actionActor.GetComponent <BaseCharacter>() == null)
                    {
                        return;
                    }

                    BaseCharacter thisChar = actionActor.GetComponent <BaseCharacter>();

                    thisChar.OrderToReveal();
                    CheckNextMove(thisAction);
                }
                else if (thisAction.actionType == DramaActionType.ShowConversation)
                {
                    if (DialogueManager.GetInstance == null)
                    {
                        return;
                    }

                    ConversationInformationData thisConversation = DialogueManager.GetInstance.dialogueStorage.ObtainConversationByTitle(thisAction.conversationTitle);
                    thisConversation.conversingActors = new List <BaseCharacter>();

                    DialogueManager.GetInstance.StartConversation(thisConversation, () => CheckNextMove(thisAction));
                }
                else if (thisAction.actionType == DramaActionType.ShowTabCover)
                {
                    if (TransitionManager.GetInstance == null)
                    {
                        return;
                    }

                    TransitionManager.GetInstance.ShowTabCover();
                }
                else if (thisAction.actionType == DramaActionType.HideTabCover)
                {
                    if (TransitionManager.GetInstance == null)
                    {
                        return;
                    }

                    TransitionManager.GetInstance.HideTabCover();
                }
                else if (thisAction.actionType == DramaActionType.FadeToDark)
                {
                    darkFader.FadeToDark(() => CheckNextMove(thisAction));
                }
                else if (thisAction.actionType == DramaActionType.FadeToClear)
                {
                    darkFader.FadeToClear(() => CheckNextMove(thisAction));
                }
                else if (thisAction.actionType == DramaActionType.LoadThisScene)
                {
                    if (TransitionManager.GetInstance == null)
                    {
                        return;
                    }

                    DialogueManager.GetInstance.afterConversationCallBack.Clear();

                    TransitionManager.GetInstance.LoadScene(thisAction.loadThisScene, ClearDrama);
                }
            }
        }
コード例 #6
0
        public void ShowActionList()
        {
            GUILayout.BeginArea(new Rect(480, actorListPosY + 50, 400, position.height - 350));

            GUILayout.BeginHorizontal();
            GUILayout.Box("Current Action List", titleText, GUILayout.Width(175), GUILayout.Height(20));
            GUILayout.EndHorizontal();
            if (curFrame.actionsOnFrameList == null)
            {
                curFrame.actionsOnFrameList = new List <DramaAction>();
            }
            actionListScrollPos = GUILayout.BeginScrollView(actionListScrollPos, new GUIStyle("RL Background"), GUILayout.Width(180), GUILayout.Height(position.height - 450));
            if (selectedFrame != null && curFrame.actionsOnFrameList != null && curFrame.actionsOnFrameList.Count > 0)
            {
                int removeThisIdx = -1;
                for (int i = 0; i < curFrame.actionsOnFrameList.Count; i++)
                {
                    GUILayout.BeginHorizontal();
                    bool isClicked = false;
                    bool isRemoved = false;

                    if (curFrame.actionsOnFrameList[i].thisActor == null)
                    {
                        curFrame.actionsOnFrameList[i].thisActor = new DramaActor();
                        curFrame.actionsOnFrameList[i].thisActor.characterName       = curDrama.actors[0].characterName;
                        curFrame.actionsOnFrameList[i].thisActor.characterPrefabPath = curDrama.actors[0].characterPrefabPath;
                        curFrame.actionsOnFrameList[i].thisActor.actorType           = curDrama.actors[0].actorType;
                    }
                    string btnTitle = "";
                    switch (curFrame.actionsOnFrameList[i].actionType)
                    {
                    case DramaActionType.MakeActorMove:
                        btnTitle = "[" + curFrame.actionsOnFrameList[i].thisActor.characterName + "] Moving";
                        break;

                    case DramaActionType.ShowConversation:
                        btnTitle = "Start Conversation";
                        break;

                    case DramaActionType.BanishActor:
                        btnTitle = "[" + curFrame.actionsOnFrameList[i].thisActor.characterName + "] Banish Actor";
                        break;

                    case DramaActionType.ShowTabCover:
                        btnTitle = "Show Tab Cover";
                        break;

                    case DramaActionType.HideTabCover:
                        btnTitle = "Hide Tab Cover";
                        break;

                    case DramaActionType.ShowActor:
                        btnTitle = "[" + curFrame.actionsOnFrameList[i].thisActor.characterName + "] Show Actor";
                        break;

                    case DramaActionType.FadeToDark:
                        btnTitle = "Fade To Dark";
                        break;

                    case DramaActionType.FadeToClear:
                        btnTitle = "Fade To Clear";
                        break;

                    case DramaActionType.LoadThisScene:
                        btnTitle = "[Load]" + curFrame.actionsOnFrameList[i].loadThisScene.ToString();
                        break;

                    default:
                        break;
                    }

                    isClicked = GUILayout.Button(btnTitle, (selectedAction != null && curFrame.actionsOnFrameList[i] == selectedAction) ? selectedText : notSelectedText);
                    isRemoved = GUILayout.Button("-", GUILayout.MaxWidth(50), GUILayout.MaxHeight(15));
                    GUILayout.EndHorizontal();
                    if (isClicked)
                    {
                        easyPlacePosition = null;
                        selectedActionIdx = i;
                        selectedAction    = selectedFrame.actionsOnFrameList[selectedActionIdx];
                        curAction         = selectedAction;
                        isClicked         = false;
                    }
                    if (isRemoved)
                    {
                        removeThisIdx = i;
                        isRemoved     = false;
                    }
                }

                if (removeThisIdx != -1)
                {
                    curFrame.actionsOnFrameList.RemoveAt(removeThisIdx);
                }
            }
            GUILayout.EndScrollView();
            GUILayout.EndArea();

            GUILayout.BeginArea(new Rect(480, actorListPosY + 230, 400, position.height - 350));
            bool addNewAction = GUILayout.Button("+", GUILayout.MaxWidth(50));

            if (addNewAction)
            {
                DramaAction tmp = new DramaAction();
                curFrame.actionsOnFrameList.Add(tmp);
            }

            GUILayout.EndArea();
        }
コード例 #7
0
        public void ShowCurrentDrama()
        {
            #region Current Scene Actors
            GUILayout.BeginArea(new Rect(480, 15, leftPanelWidth, 300));
            GUILayout.BeginHorizontal();
            GUILayout.Box("Current Scene Actors", titleText, GUILayout.Width(175), GUILayout.Height(20));
            GUILayout.EndHorizontal();

            bool addActor = false;
            if (curDrama.actors == null)
            {
                curDrama.actors = new List <DramaActor>();
            }

            currentActorListScrollPos = GUILayout.BeginScrollView(actorListScrollPos, new GUIStyle("RL Background"), GUILayout.Width(180), GUILayout.Height(position.height - 450));
            if (curDrama.actors != null && curDrama.actors.Count > 0)
            {
                List <string> actorNames = new List <string>();

                for (int i = 0; i < curDramaStorage.actorStorage.Count; i++)
                {
                    actorNames.Add(curDramaStorage.actorStorage[i].actorName);
                }

                int removeThisIdx = -1;
                for (int i = 0; i < curDrama.actors.Count; i++)
                {
                    bool isRemoved     = false;
                    int  selectedActor = (curDramaStorage.actorStorage != null && curDramaStorage.actorStorage.Count > 0) ? curDramaStorage.actorStorage.Count - 1 : -1;
                    EditorGUILayout.BeginHorizontal();
                    if (curDramaStorage.actorStorage.Find(x => x.actorName == curDrama.actors[i].characterName) != null)
                    {
                        selectedActor = curDramaStorage.actorStorage.FindIndex(x => x.actorName == curDrama.actors[i].characterName);
                    }
                    if (selectedActor >= 0)
                    {
                        selectedActor = EditorGUILayout.Popup(selectedActor, actorNames.ToArray(), GUILayout.MaxWidth(130));
                        isRemoved     = GUILayout.Button("-", GUILayout.Width(30));
                        if (isRemoved)
                        {
                            removeThisIdx = i;
                        }
                    }
                    else
                    {
                        EditorGUILayout.LabelField("No Actor Available", GUILayout.MaxWidth(200));
                    }
                    if (curDrama.actors[i].characterName != curDramaStorage.actorStorage[selectedActor].actorName)
                    {
                        curDrama.actors[i].characterName       = curDramaStorage.actorStorage[selectedActor].actorName;
                        curDrama.actors[i].characterPrefabPath = curDramaStorage.actorStorage[selectedActor].prefabPath;
                        curDrama.actors[i].actorType           = curDramaStorage.actorStorage[selectedActor].actorType;
                    }
                    EditorGUILayout.EndHorizontal();
                }

                if (removeThisIdx != -1)
                {
                    curDrama.actors.RemoveAt(removeThisIdx);
                }
            }

            GUILayout.EndScrollView();
            GUILayout.BeginHorizontal();
            addActor = GUILayout.Button("+", GUILayout.MaxWidth(50));
            GUILayout.EndHorizontal();
            if (addActor)
            {
                DramaActor newActor = new DramaActor();
                newActor.characterName       = curDramaStorage.actorStorage[0].actorName;
                newActor.characterPrefabPath = curDramaStorage.actorStorage[0].prefabPath;
                newActor.actorType           = curDramaStorage.actorStorage[0].actorType;

                curDrama.actors.Add(newActor);
            }
            GUILayout.EndArea();
            #endregion

            GUILayout.BeginArea(new Rect(15, 15, leftPanelWidth, 300));

            if (curFrame == null)
            {
                curFrame = new DramaFrame();
            }
            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Scenario Act Name:", EditorStyles.boldLabel, GUILayout.Width(80));
            curDrama.scenarioName = EditorGUILayout.TextField(curDrama.scenarioName, GUILayout.MaxWidth(380));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Drama Type:", EditorStyles.boldLabel, GUILayout.Width(80));
            curDrama.sceneType = (DramaSceneType)EditorGUILayout.EnumPopup(curDrama.sceneType, GUILayout.MaxWidth(200));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Box("Current Frame", titleText, GUILayout.Width(450), GUILayout.Height(20));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Description:", EditorStyles.boldLabel, GUILayout.Width(80));
            curFrame.description = EditorGUILayout.TextField(curFrame.description, GUILayout.MaxWidth(367));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            if (curDrama != null && curDrama.actionsPerFrame != null)
            {
                if (selectedFrameIdx >= curDrama.actionsPerFrame.Count - 1)
                {
                    curFrame.callNextStory = EditorGUILayout.Toggle(curFrame.callNextStory, GUILayout.MaxWidth(20));
                    GUILayout.Label("Call Next Story:", EditorStyles.boldLabel, GUILayout.Width(100));
                    if (curFrame.callNextStory)
                    {
                        curFrame.nextDramaTitle = EditorGUILayout.TextField(curFrame.nextDramaTitle, GUILayout.MaxWidth(325));
                    }
                }
                else
                {
                    curFrame.callNextStory  = false;
                    curFrame.nextDramaTitle = "";
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Box("Frame List", titleText, GUILayout.Width(450), GUILayout.Height(20));
            GUILayout.EndHorizontal();
            frameListScrollPos = GUILayout.BeginScrollView(frameListScrollPos, new GUIStyle("RL Background"), GUILayout.Width(450), GUILayout.Height(position.height - 400));
            if (curDrama.actionsPerFrame == null)
            {
                curDrama.actionsPerFrame = new List <DramaFrame>();
            }
            if (curDrama.actionsPerFrame != null && curDrama.actionsPerFrame.Count > 0)
            {
                for (int i = 0; i < curDrama.actionsPerFrame.Count; i++)
                {
                    GUILayout.BeginHorizontal();
                    bool isClicked = false;
                    isClicked = GUILayout.Button(curDrama.actionsPerFrame[i].frameName, (selectedFrame != null && curDrama.actionsPerFrame[i].frameName == selectedFrame.frameName) ? selectedText : notSelectedText);
                    GUILayout.Label("- " + curDrama.actionsPerFrame[i].description, GUILayout.MaxWidth(350));
                    GUILayout.EndHorizontal();

                    if (isClicked)
                    {
                        GUI.FocusControl(null);
                        selectedFrameIdx = i;
                        selectedFrame    = curDrama.actionsPerFrame[selectedFrameIdx];
                        curFrame         = selectedFrame;
                        curAction        = null;
                        selectedAction   = null;
                    }
                }
            }
            GUILayout.EndScrollView();
            GUILayout.EndArea();
            GUILayout.BeginArea(new Rect(15, 320, leftPanelWidth, 300));
            GUILayout.BeginHorizontal();
            bool saveCurrentFrame = GUILayout.Button((curFrame != null && curFrame == selectedFrame) ? "Modify" : "Save", GUILayout.MaxWidth(100));
            bool addNewFrame      = GUILayout.Button("Create New", GUILayout.MaxWidth(100));
            if (saveCurrentFrame)
            {
                GUI.FocusControl(null);
                if (string.IsNullOrEmpty(curFrame.description))
                {
                    return;
                }
                if (curFrame == selectedFrame)
                {
                    int idx = curDrama.actionsPerFrame.FindIndex(x => x.frameName == curFrame.frameName);
                    curDrama.actionsPerFrame[idx] = curFrame;
                }
                else
                {
                    curFrame.frameName = "Frame#" + (curDrama.actionsPerFrame.Count + 1);
                    curDrama.actionsPerFrame.Add(curFrame);
                    curFrame      = new DramaFrame();
                    selectedFrame = null;
                }
                Save();
            }
            if (addNewFrame)
            {
                GUI.FocusControl(null);
                curFrame      = new DramaFrame();
                selectedFrame = null;
            }
            if (selectedFrame != null)
            {
                bool removeSelectedFrame = GUILayout.Button("-", GUILayout.MaxWidth(100));
                if (removeSelectedFrame)
                {
                    GUI.FocusControl(null);
                    if (curDrama.actionsPerFrame.Find(x => x.frameName == selectedFrame.frameName) != null)
                    {
                        curDrama.actionsPerFrame.Remove(selectedFrame);
                        selectedFrame = null;
                        curFrame      = new DramaFrame();
                    }
                }
            }
            GUILayout.EndHorizontal();
            GUILayout.EndArea();
        }
コード例 #8
0
        public void ShowDramaList()
        {
            if (curDramaStorage.dramaSceneStorage == null)
            {
                curDramaStorage.dramaSceneStorage = new List <DramaScenario>();
            }
            bool addEvent    = false;
            bool saveEvent   = false;
            bool removeEvent = false;

            GUILayout.BeginArea(new Rect(680, 10, 400, position.height - 375));
            GUILayout.BeginHorizontal();
            GUILayout.Box("Drama Scene List", titleText, GUILayout.Width(295), GUILayout.Height(20));
            GUILayout.EndHorizontal();

            dramaListScrollPos = GUILayout.BeginScrollView(dramaListScrollPos, new GUIStyle("RL Background"), GUILayout.Width(300), GUILayout.Height(position.height - 400));

            if (curDramaStorage.dramaSceneStorage != null && curDramaStorage.dramaSceneStorage.Count > 0)
            {
                for (int i = 0; i < curDramaStorage.dramaSceneStorage.Count; i++)
                {
                    bool   isClicked = false;
                    string listName  = "";

                    GUILayout.BeginHorizontal();
                    isClicked = GUILayout.Button(curDramaStorage.dramaSceneStorage[i].scenarioName, (selectedDrama != null && curDramaStorage.dramaSceneStorage[i].scenarioName == selectedDrama.scenarioName) ? selectedText : notSelectedText);
                    if (curDramaStorage.dramaSceneStorage[i].actionsPerFrame != null && curDramaStorage.dramaSceneStorage[i].actionsPerFrame.Count > 0)
                    {
                        listName = "[Frames: " + curDramaStorage.dramaSceneStorage[i].actionsPerFrame.Count + "]";
                        GUILayout.Label(listName);
                    }
                    GUILayout.EndHorizontal();
                    if (isClicked)
                    {
                        GUI.FocusControl(null);
                        if (curDramaStorage.dramaSceneStorage[i] != null)
                        {
                            selectedDrama    = curDramaStorage.dramaSceneStorage[i];
                            selectedDramaIdx = i;
                            curDrama         = selectedDrama;
                        }
                        curAction     = null;
                        selectedFrame = null;
                        isClicked     = false;
                    }
                }
            }

            GUILayout.EndArea();
            GUILayout.EndScrollView();

            GUILayout.BeginArea(new Rect(680, position.height - 360, 400, 225));

            GUILayout.BeginHorizontal();
            saveEvent = GUILayout.Button((curDrama == selectedDrama) ? "Modify" : "Save", GUILayout.MaxWidth(100));

            if (curDramaStorage.dramaSceneStorage == null)
            {
                curDramaStorage.dramaSceneStorage = new List <DramaScenario>();
            }

            if (curDrama == null)
            {
                curDrama = new DramaScenario();
            }
            if (curDramaStorage.dramaSceneStorage.Count <= 0 || curDramaStorage.dramaSceneStorage.Find(x => x.scenarioName == curDrama.scenarioName) != null)
            {
                addEvent = GUILayout.Button("Create New", GUILayout.MaxWidth(100));
            }
            if (curDramaStorage.dramaSceneStorage.Find(x => x.scenarioName == curDrama.scenarioName) != null)
            {
                removeEvent = GUILayout.Button("Remove", GUILayout.MaxWidth(100));
            }
            GUILayout.EndHorizontal();

            GUILayout.EndArea();

            // ADD BUTTON
            if (addEvent)
            {
                curDrama      = new DramaScenario();
                selectedDrama = null;
            }
            // REMOVE BUTTON
            if (removeEvent)
            {
                GUI.FocusControl(null);
                removeEvent = false;
                if (selectedDrama != null)
                {
                    curDramaStorage.dramaSceneStorage.RemoveAt(selectedDramaIdx);
                    selectedDrama = null;
                    curDrama      = new DramaScenario();
                }
            }
            // SAVE BUTTON
            if (saveEvent && !string.IsNullOrEmpty(curDrama.scenarioName))
            {
                GUI.FocusControl(null);
                if (curDramaStorage.dramaSceneStorage == null)
                {
                    curDramaStorage.dramaSceneStorage = new List <DramaScenario>();
                }
                if (curDramaStorage.dramaSceneStorage.Find(x => x.scenarioName == curDrama.scenarioName) == null)
                {
                    curDramaStorage.dramaSceneStorage.Add(curDrama);
                    curDrama = new DramaScenario();
                }
                else
                {
                    // MODIFY CURRENT EVENT
                    if ((curDrama == selectedDrama))
                    {
                        curDramaStorage.dramaSceneStorage[selectedDramaIdx] = curDrama;
                        curDrama      = new DramaScenario();
                        selectedDrama = null;
                    }
                    else
                    {
                        Debug.LogError("MULTIPLE EVENTS WITH SAME TITLE OCCURRED, PLEACE CHECK LIST!");
                    }
                }
                saveEvent = false;
                Save();
            }
        }