コード例 #1
0
ファイル: Program.cs プロジェクト: oblivious/Oblivious
        public static void Main(string[] args)
        {
            var topLevelClass = new MyTopLevelClass();

            Console.WriteLine("As Base Class: " + ((MyBaseClass)topLevelClass).ToString());
            Console.WriteLine("As Derived Class:" + ((MyDerivedClass)topLevelClass).ToString());
            Console.WriteLine("As Top Level Class: " + topLevelClass);

            Console.WriteLine("Base Class Valid Length: " + MyBaseClass.ValidLength);
            Console.WriteLine("Derived Class Valid Length:" + MyDerivedClass.ValidLength);
            Console.WriteLine("Top Level Class Valid Length: " + MyTopLevelClass.ValidLength);

            Console.WriteLine("As Base Class: " + ((MyBaseClass)topLevelClass).IsValid);
            Console.WriteLine("As Derived Class:" + ((MyDerivedClass)topLevelClass).IsValid);
            Console.WriteLine("As Top Level Class: " + topLevelClass.IsValid);


            topLevelClass.Noodle();

            TC obj = new TC();
            obj.Display();

            var fivesie = new Fivesie();
            fivesie.TheMethod();
            ((Onesie)fivesie).TheMethod();
        }
コード例 #2
0
ファイル: LTR_Manager.cs プロジェクト: ufjl0683/Center
        public void setLTR_stop(TC.RMSDeviceWrapper dev)
        {
            if (!hsEvents.ContainsKey(dev.deviceName))
                 return;

             hsEvents[dev.deviceName].invokeStop();

             hsEvents.Remove(dev.deviceName);
        }
コード例 #3
0
ファイル: LTR_Manager.cs プロジェクト: ufjl0683/Center
        public void setLTR_start(TC.RMSDeviceWrapper dev)
        {
            if (hsEvents.ContainsKey(dev.deviceName))
                 return;

             LTR_Range evt= new LTR_Range(dev);
             hsEvents.Add(dev.deviceName,evt);
             Program.matrix.event_mgr.AddEvent(evt);
        }
コード例 #4
0
        public void set_start(TC.RMSDeviceWrapper dev)
        {
            if (hsEvents.ContainsKey(dev.deviceName))
                 return;
             //非反應計畫
             if ((Program.matrix.getDeviceWrapper(dev.deviceName) as TC.OutPutDeviceBase).getOutputdata().mode == RemoteInterface.HC.OutputModeEnum.ResponsePlanMode)
                 return;

             RampControlRange evt= new RampControlRange(dev);
             hsEvents.Add(dev.deviceName,evt);
             Program.matrix.event_mgr.AddEvent(evt);
        }
コード例 #5
0
ファイル: RampVDData.cs プロジェクト: ufjl0683/Center
        public RampVDData(string deviceName,string lineid,string dir,string divisionId,string divisionName,string InOut,TC.VDDeviceWrapper vd,int mile_m,int laneid)
        {
            this.deviceName = deviceName;
            this.lineid = lineid;
            this.direction = dir;
            this.divisionId = divisionId;
            this.divisionName = divisionName;
            this.InOut = InOut;

            this.vd = vd;
            this.mile_m = mile_m;
            this.laneid = laneid;
            this.vd.OnEvent += new EventHandler(RampVDData_OnEvent);
            if (laneid != -1)
            {
                this.tmr1min.Elapsed += new System.Timers.ElapsedEventHandler(tmr1min_Elapsed);
                this.tmr1min.Start();
            }
        }
コード例 #6
0
ファイル: RampControlRang.cs プロジェクト: ufjl0683/Center
        public RampControlRange(TC.RMSDeviceWrapper dev)
        {
            this.dev = dev;
            //this.group = group;
             //   this.devName = group.devName;
            this.m_alarm_type = AlarmType.TRAFFIC;
            this.m_class = 49;

            try
            {
              //  this.m_eventmode = Global.getEventMode(m_class);
                this.m_eventmode = Global.getEventModeBySectionID(this.getSectionId(), this.m_class, ref this.IsLock, ref this.description);
                this.EventId = Global.getEventId();
            }
            catch (Exception ex)
            {
                this.m_eventmode = EventMode.DontCare;
                RemoteInterface.Util.SysLog("evterr.txt", ex.Message + "," + ex.StackTrace);
            }
        }
コード例 #7
0
ファイル: APIDRangeData.cs プロジェクト: ufjl0683/Center
        public APIDRangeData(TC.VDDeviceWrapper vd,AIDTYPE aidtype)
            : base()
        {
            this.vddev = vd;
               // this.m_level = vd.jamLevel;
            this.AidType = aidtype;
            this.EventId = Global.getEventId();

            this.m_alarm_type = AlarmType.GEN;
            this.m_class = 129;  //一般道路壅塞
            try
            {
                //this.m_eventmode = Global.getEventMode(this.m_class, out this.IsLock,out this.description);
                Global.getEventModeBySectionID(this.getSectionId(), this.m_class, ref this.IsLock, ref this.description);
            }
            catch
            {
                this.m_eventmode = EventMode.DontCare;
            }
        }
コード例 #8
0
    static void Main()
    {
        Console.WriteLine("Overloading");
        Foo(105);
        Foo(18039932103);

        //Overriding
        Console.WriteLine("");
        Console.WriteLine("Overriding");
        BC b;
        b = new BC();
        b.Display();

        b = new DC();
        b.Display();

        b = new TC();
        b.Display();
        Console.Read();
    }
コード例 #9
0
ファイル: MetroNetworkRange.cs プロジェクト: ufjl0683/Center
        public MetroNetworkRange(TC.RGSDeviceWrapper rgsdev, int g_code_id)
            : base()
        {
            this.RgsDevice = rgsdev;
               this.g_code_id = g_code_id;

               this.m_alarm_type = AlarmType.TRAFFIC;
               this.m_class = 42;

               try
               {
               //  this.m_eventmode = Global.getEventMode(m_class);
               this.m_eventmode = Global.getEventModeBySectionID(this.getSectionId(), this.m_class, ref this.IsLock, ref this.description);
               this.EventId = Global.getEventId();
               }
               catch (Exception ex)
               {
               this.m_eventmode = EventMode.DontCare;
               RemoteInterface.Util.SysLog("evterr.log", ex.Message + "," + ex.StackTrace);
               }
        }
コード例 #10
0
        public CompletablesWindow(Rect aStartPos, GUIContent aContent, GUIStyle aStyle, params GUILayoutOption[] aOptions)
            : base(aStartPos, aContent, aStyle, aOptions)
        {
            completablesList = new DataControlList()
            {
                RequestRepaint = Repaint,
                Columns        = new List <ColumnList.Column>()
                {
                    new ColumnList.Column()
                    {
                        Text = TC.get("Analytics.Completable.Id")
                    },
                    new ColumnList.Column()
                    {
                        Text = TC.get("Analytics.Completable.Start")
                    },
                    new ColumnList.Column()
                    {
                        Text = TC.get("Analytics.Completable.End")
                    },
                    new ColumnList.Column()
                    {
                        Text = TC.get("Analytics.Completable.Progress")
                    },
                    new ColumnList.Column()
                    {
                        Text = TC.get("Analytics.Completable.Score")
                    },
                    new ColumnList.Column()
                    {
                        Text        = TC.get("Repeatable"),
                        SizeOptions = new GUILayoutOption[] { GUILayout.Width(70) }
                    }
                },
                drawCell = (rect, row, column, isActive, isFocused) =>
                {
                    var completable = completablesList.list[row] as CompletableDataControl;
                    switch (column)
                    {
                    case 0:
                        completable.renameElement(EditorGUI.TextField(rect, completable.getId()));
                        break;

                    case 1:
                        if (GUI.Button(rect, completable.getStart().getContent().ToString()))
                        {
                            MilestoneEditorWindow.ShowMilestoneEditor(rect, completable.getStart());
                        }
                        break;

                    case 2:
                        if (GUI.Button(rect, completable.getEnd().getContent().ToString()))
                        {
                            MilestoneEditorWindow.ShowMilestoneEditor(rect, completable.getEnd());
                        }
                        break;

                    case 3:
                        if (GUI.Button(rect, TC.get("Analytics.Completable.Define")))
                        {
                            ProgressEditorWindow.ShowProgressEditor(rect, completable.getProgress());
                        }
                        break;

                    case 4:
                    {
                        if (Available)
                        {
                            ScoreEditor(rect, completable.getScore());
                        }
                        else
                        {
                            EditorGUI.HelpBox(rect, TC.get("Condition.Var.Warning"), MessageType.Error);
                        }
                    }
                    break;

                    case 5:
                        completable.setRepeatable(GUI.Toggle(rect, completable.getRepeatable(), "?"));
                        break;
                    }
                }
            };
        }
コード例 #11
0
        public override bool isValid(string currentPath, List <string> incidences)
        {
            bool valid = true;

            // Iterate through the actions
            for (int i = 0; i < actionsDataControlList.Count; i++)
            {
                string actionPath = currentPath + " >> " + TC.get("Element.Action") + " #" + (i + 1) + " (" + TC.getElement(actionsDataControlList[i].getType()) + ")";
                valid &= actionsDataControlList[i].isValid(actionPath, incidences);
            }

            return(valid);
        }
コード例 #12
0
    public override void Draw(int aID)
    {
        GUILayout.BeginArea(appearanceTableRect);
        GUILayout.BeginHorizontal();
        GUILayout.Box(TC.get("Scene.LookPanelTitle"), GUILayout.Width(windowWidth * 0.44f));
        GUILayout.Box(TC.get("Conditions.Title"), GUILayout.Width(windowWidth * 0.44f));
        GUILayout.EndHorizontal();
        scrollPosition = GUILayout.BeginScrollView(scrollPosition);
        // Appearance table
        for (int i = 0; i < Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreasList().Count; i++)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreasList()[i].getId(), GUILayout.Width(windowWidth * 0.44f));
            GUILayout.Label(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreasList()[i].getConditions
                                ().size().ToString(), GUILayout.Width(windowWidth * 0.44f));
            GUILayout.EndHorizontal();
        }
        GUILayout.EndScrollView();
        GUILayout.EndArea();

        /*
         * Right panel
         */
        GUILayout.BeginArea(rightPanelRect);
        GUI.skin = noBackgroundSkin;
        if (GUILayout.Button(addTexture, GUILayout.MaxWidth(0.08f * windowWidth)))
        {
            Debug.Log("ADD");
        }
        if (GUILayout.Button(duplicateImg, GUILayout.MaxWidth(0.08f * windowWidth)))
        {
            Debug.Log("Duplicate");
        }
        if (GUILayout.Button(clearImg, GUILayout.MaxWidth(0.08f * windowWidth)))
        {
            Debug.Log("Clear");
        }
        GUI.skin = defaultSkin;
        GUILayout.EndArea();

        GUILayout.Space(30);

        GUILayout.BeginArea(propertiesTable);
        // Background chooser
        GUILayout.Label(TC.get("Background image of the scene"));
        GUILayout.BeginHorizontal();
        if (GUILayout.Button(clearImg, GUILayout.Width(0.1f * windowWidth)))
        {
            backgroundPath = "";
        }
        GUILayout.Box(backgroundPath, GUILayout.Width(0.7f * windowWidth));
        if (GUILayout.Button(TC.get("Buttons.Select"), GUILayout.Width(0.19f * windowWidth)))
        {
            ShowAssetChooser(AssetType.BACKGROUND);
        }
        GUILayout.EndHorizontal();

        // Foreground chooser
        GUILayout.Label(TC.get("Resources.DescriptionSceneForeground"));
        GUILayout.BeginHorizontal();
        if (GUILayout.Button(clearImg, GUILayout.Width(0.1f * windowWidth)))
        {
            foregroundMaskPath = "";
        }
        GUILayout.Box(foregroundMaskPath, GUILayout.Width(0.7f * windowWidth));
        if (GUILayout.Button(TC.get("Buttons.Select"), GUILayout.Width(0.19f * windowWidth)))
        {
            ShowAssetChooser(AssetType.FOREGROUND);
        }
        GUILayout.EndHorizontal();

        // Music chooser
        GUILayout.Label(TC.get("Resources.DescriptionSceneMusic"));
        GUILayout.BeginHorizontal();
        if (GUILayout.Button(clearImg, GUILayout.Width(0.1f * windowWidth)))
        {
            musicPath = "";
        }
        GUILayout.Box(musicPath, GUILayout.Width(0.7f * windowWidth));
        if (GUILayout.Button(TC.get("Buttons.Select"), GUILayout.Width(0.19f * windowWidth)))
        {
            ShowAssetChooser(AssetType.MUSIC);
        }
        GUILayout.EndHorizontal();

        GUILayout.EndArea();

        if (backgroundPath != "")
        {
            GUI.DrawTexture(previewRect, backgroundPreview, ScaleMode.ScaleToFit);
        }
    }
コード例 #13
0
        protected override void DrawInspector()
        {
            var prevWorkingChar = workingCharacter;

            var player = Controller.Instance.SelectedChapterDataControl.getPlayer();

            if (Target is NodeDataControl || IsPlayer)
            {
                workingCharacter = player;
            }
            else if (Target is NPCDataControl)
            {
                workingCharacter = Target as NPCDataControl;
            }
            else
            {
                workingCharacter = Controller.Instance.SelectedChapterDataControl.getNPCsList().getNPCs()[GameRources.GetInstance().selectedCharacterIndex];
            }

            if (workingCharacter != prevWorkingChar)
            {
                RefreshPathInformation(workingCharacter);
            }

            // Appearance table
            appearanceEditor.Data = workingCharacter;
            appearanceEditor.OnInspectorGUI();

            GUILayout.Label(TC.get("Resources.ResourcesGroup"));
            selectedAnimationGroup = groups[EditorGUILayout.Popup((int)selectedAnimationGroup, groupNames.Select(kv => TC.get(kv.Value)).ToArray())];

            // Draw the animation selector for each animation in the selected resource group
            foreach (var resourceTypeGroup in resourceTypeGroups[selectedAnimationGroup])
            {
                DoAnimationSelector(fields[resourceTypeGroup.Key], resourceTypeGroup.Value);
            }
        }
コード例 #14
0
        void OnGUI()
        {
            scrollPosition = GUILayout.BeginScrollView(scrollPosition);
            GUI.DrawTexture(imageBackgroundRect, backgroundPreviewTex);
            //if (dragging)
            //    GUI.DrawTexture(playerRect, selectedPlayerTex);
            GUILayout.EndScrollView();

            if (Event.current.type == EventType.mouseDrag)
            {
                if (!useTrajectory)
                {
                    // Check if start position is over player
                    if (playerRect.Contains(Event.current.mousePosition))
                    {
                        if (!dragging)
                        {
                            dragging = true;
                            startPos = currentPos;
                        }
                    }
                }
                // For editing trajectory nodes recognizing object under mouse pointer is done
                // during iterating over all nodes
                else
                {
                    if (!dragging)
                    {
                        dragging = true;
                        startPos = currentPos;
                    }
                }
                currentPos = Event.current.mousePosition;
            }

            if (Event.current.type == EventType.mouseUp)
            {
                dragging = false;
            }

            /*
             * Properties part
             */
            GUILayout.Label(TC.get("Scene.UseTrajectoryPanel"));
            GUILayout.Space(5);
            useTrajectory      = GUILayout.Toggle(!useInitialPosition, new GUIContent(TC.get("Scene.UseTrajectory")));
            useInitialPosition = GUILayout.Toggle(!useTrajectory, new GUIContent(TC.get("Scene.UseInitialPosition")));
            if (useInitialPosition != useInitialPositionLast)
            {
                OnMovementTypeChange(useInitialPosition);
            }
            GUILayout.Space(5);



            /*
             * Initial positon
             */
            if (useInitialPosition)
            {
                // EVENT
                if (dragging)
                {
                    OnBeingDragged();
                }

                playerRect = new Rect(x - 0.5f * playerTex.width * sceneRef.getPlayerScale(), y - playerTex.height * sceneRef.getPlayerScale(), playerTex.width * sceneRef.getPlayerScale(), playerTex.height * sceneRef.getPlayerScale());
                GUI.DrawTexture(playerRect, playerTex);

                GUILayout.BeginHorizontal();
                GUILayout.Box("X", GUILayout.Width(0.33f * backgroundPreviewTex.width));
                GUILayout.Box("Y", GUILayout.Width(0.33f * backgroundPreviewTex.width));
                GUILayout.Box(TC.get("SceneLocation.Scale"), GUILayout.Width(0.3f * backgroundPreviewTex.width));
                GUILayout.EndHorizontal();


                GUILayout.BeginHorizontal();
                x = EditorGUILayout.IntField(
                    sceneRef.getDefaultInitialPositionX(),
                    GUILayout.Width(0.33f * backgroundPreviewTex.width));
                y = EditorGUILayout.IntField(
                    sceneRef.getDefaultInitialPositionY(),
                    GUILayout.Width(0.33f * backgroundPreviewTex.width));

                sceneRef.setDefaultInitialPosition(x, y);

                sceneRef.setPlayerScale(
                    EditorGUILayout.FloatField(
                        sceneRef.getPlayerScale(), GUILayout.Width(0.33f * backgroundPreviewTex.width)));
                GUILayout.EndHorizontal();
            }

            /*
             * Trajectory
             */
            else
            {
                // EVENTS
                if (Event.current.type == EventType.mouseDown && imageBackgroundRect.Contains(Event.current.mousePosition))
                {
                    int clickedIndex = -1;

                    for (int i = 0; i < trajectory.getNodes().Count; i++)
                    {
                        if (
                            trajectory.getNodes()[i].getEditorRect(playerTex.width, playerTex.height)
                            .Contains(Event.current.mousePosition))
                        {
                            clickedIndex = i;
                        }
                    }

                    if (trajectoryTool == TrajectoryToolType.EDIT_NODE)
                    {
                        if (clickedIndex == -1)
                        {
                            AddNode(Event.current.mousePosition);
                        }
                    }
                    else if (trajectoryTool == TrajectoryToolType.DELETE_NODE)
                    {
                        if (clickedIndex != -1)
                        {
                            DeleteNode(clickedIndex);
                        }
                    }
                    else if (trajectoryTool == TrajectoryToolType.INIT_NODE)
                    {
                        if (clickedIndex != -1)
                        {
                            SetInitNode(clickedIndex);
                        }
                    }
                    else if (trajectoryTool == TrajectoryToolType.EDIT_SIDE)
                    {
                        if (clickedIndex != -1)
                        {
                            SetSideNode(clickedIndex);
                        }
                    }
                }

                if (dragging)
                {
                    if (trajectoryTool == TrajectoryToolType.EDIT_NODE)
                    {
                        int clickedIndex = -1;

                        for (int i = 0; i < trajectory.getNodes().Count; i++)
                        {
                            if (
                                trajectory.getNodes()[i].getEditorRect(playerTex.width, playerTex.height)
                                .Contains(Event.current.mousePosition))
                            {
                                clickedIndex = i;
                            }
                        }
                        if (clickedIndex != -1)
                        {
                            // LEFT MOUSE BUTTON - move node
                            if (Event.current.button == 0)
                            {
                                OnBeingDraggedTrajectoryNode(clickedIndex);
                            }
                        }
                    }
                }

                //if (Event.current.type == EventType.ScrollWheel)
                if (Event.current.keyCode == KeyCode.Plus || Event.current.keyCode == KeyCode.KeypadPlus || Event.current.keyCode == KeyCode.Minus || Event.current.keyCode == KeyCode.KeypadMinus)
                {
                    if (trajectoryTool == TrajectoryToolType.EDIT_NODE)
                    {
                        int clickedIndex = -1;

                        for (int i = 0; i < trajectory.getNodes().Count; i++)
                        {
                            if (
                                trajectory.getNodes()[i].getEditorRect(playerTex.width, playerTex.height)
                                .Contains(Event.current.mousePosition))
                            {
                                clickedIndex = i;
                            }
                        }

                        if (clickedIndex != -1)
                        {
                            if (Event.current.keyCode == KeyCode.Plus || Event.current.keyCode == KeyCode.KeypadPlus)
                            {
                                OnBeingTrajectoryNodeRescaled(clickedIndex, 0.01f);
                            }
                            else if (Event.current.keyCode == KeyCode.Minus || Event.current.keyCode == KeyCode.KeypadMinus)
                            {
                                OnBeingTrajectoryNodeRescaled(clickedIndex, -0.01f);
                            }
                        }
                    }
                }

                if (trajectoryTool == TrajectoryToolType.EDIT_SIDE)
                {
                    // If selected begin of side
                    if (beginSideIndex != -1)
                    {
                        DrawLine(
                            new Vector2(trajectory.getNodes()[beginSideIndex].getX(),
                                        trajectory.getNodes()[beginSideIndex].getY()), Event.current.mousePosition, 2);
                    }
                }

                // DRAW NODES
                foreach (Trajectory.Node node in trajectory.getNodes())
                {
                    GUI.DrawTexture(node.getEditorRect(playerRect.width, playerRect.height), playerTex);
                }

                // DRAW SIDES
                foreach (Trajectory.Side side in trajectory.getSides())
                {
                    DrawLine(
                        new Vector2(trajectory.getNodeForId(side.getIDStart()).getX(),
                                    trajectory.getNodeForId(side.getIDStart()).getY()),
                        new Vector2(trajectory.getNodeForId(side.getIDEnd()).getX(),
                                    trajectory.getNodeForId(side.getIDEnd()).getY()), 2);
                }

                // DRAW INITIAL NODE
                if (trajectory.getInitial() != null)
                {
                    GUI.DrawTexture(trajectory.getInitial().getEditorRect(initialNodeTex.width, initialNodeTex.height),
                                    initialNodeTex);
                }

                // BUTTONS
                GUILayout.BeginHorizontal();

                if (trajectoryTool == TrajectoryToolType.EDIT_NODE)
                {
                    GUI.skin = selectedAreaSkin;
                }
                if (GUILayout.Button(editNodeTex, GUILayout.MaxWidth(0.15f * backgroundPreviewTex.width)))
                {
                    OnEditNodeSelected();
                }
                if (trajectoryTool == TrajectoryToolType.EDIT_NODE)
                {
                    GUI.skin = defaultSkin;
                }

                if (trajectoryTool == TrajectoryToolType.EDIT_SIDE)
                {
                    GUI.skin = selectedAreaSkin;
                }
                if (GUILayout.Button(editSideTex, GUILayout.MaxWidth(0.15f * backgroundPreviewTex.width)))
                {
                    OnEditSideSelected();
                }
                if (trajectoryTool == TrajectoryToolType.EDIT_SIDE)
                {
                    GUI.skin = defaultSkin;
                }

                if (trajectoryTool == TrajectoryToolType.INIT_NODE)
                {
                    GUI.skin = selectedAreaSkin;
                }
                if (GUILayout.Button(setInitialNodeTex, GUILayout.MaxWidth(0.15f * backgroundPreviewTex.width)))
                {
                    OnInitialNodeSelected();
                }
                if (trajectoryTool == TrajectoryToolType.INIT_NODE)
                {
                    GUI.skin = defaultSkin;
                }

                if (trajectoryTool == TrajectoryToolType.DELETE_NODE)
                {
                    GUI.skin = selectedAreaSkin;
                }
                if (GUILayout.Button(deleteTex, GUILayout.MaxWidth(0.15f * backgroundPreviewTex.width)))
                {
                    OnDeleteNodeSelected();
                }
                if (trajectoryTool == TrajectoryToolType.DELETE_NODE)
                {
                    GUI.skin = defaultSkin;
                }

                GUILayout.EndHorizontal();
            }
        }
コード例 #15
0
            // check the incoming token against the previous one (on top of IS)
            void CheckTokenPair(BaseToken newToken)
            {
                BaseToken     topToken    = IS.Top;
                OperatorToken newOperator = (newToken is OperatorToken) ? (OperatorToken)newToken : null;
                TC            combi       = TokenCombi[(int)topToken.Role, (int)newToken.Role];
                string        msg;

                switch (combi)
                {
                case TC.Term_Term:
                case TC.Term_Pr:
                case TC.In_In:
                case TC.In_Po:
                case TC.In_InPo:
                case TC.Pr_In:
                case TC.Pr_Po:
                case TC.Pr_InPo:
                case TC.Po_Term:
                case TC.Po_Pr:
                    IO.Error("Syntax error -- {0} may not be followed by {1}", topToken, newToken);
                    break;

                case TC.In_EoS:
                case TC.Pr_EoS:
                    if (!ProcessIfStandAloneOperator())
                    {
                        IO.Error("Syntax error -- Unexpected end of term after {0}", topToken);
                    }
                    break;

                case TC.BoS_In:
                    inOpAtBoS = true;
                    break;

                case TC.Po_EoS:
                case TC.BoS_Po:
                case TC.BoS_InPo:
                    ProcessIfStandAloneOperator();
                    break;

                case TC.In_Term:
                    if (inOpAtBoS)
                    {
                        IO.Error("Syntax error -- {0} may not be followed by {1}", topToken, newToken);
                        inOpAtBoS = false;
                    }
                    break;

                case TC.BoS_Term:
                case TC.BoS_Pr:
                case TC.Term_In:
                case TC.Term_Po:
                case TC.Term_InPo:
                case TC.Term_EoS:
                case TC.Pr_Term:
                case TC.Po_InPo:
                    break;

                case TC.BoS_InPr:
                    newOperator.SetRole(TT.Pre);
                    break;

                case TC.Term_InPr:
                    newOperator.SetRole(TT.In);
                    break;

                case TC.In_Pr:
                    if (!topOperator.od.HasValidRightArg(newOperator.od, out msg))
                    {
                        IO.Error(msg);
                    }
                    break;

                case TC.Po_In:
                    if (!newOperator.od.HasValidLeftArg(topOperator.od, out msg))
                    {
                        IO.Error(msg);
                    }
                    break;

                case TC.Pr_Pr:
                    if (!topOperator.od.HasValidArg(newOperator.od, out msg))
                    {
                        IO.Error(msg);
                    }
                    break;

                case TC.Po_Po:
                    if (!newOperator.od.HasValidArg(topOperator.od, out msg))
                    {
                        IO.Error(msg);
                    }
                    break;

                case TC.In_InPr:
                    newOperator.SetRole(TT.Pre);
                    if (!topOperator.od.HasValidRightArg(newOperator.od, out msg))
                    {
                        IO.Error(msg);
                    }
                    break;

                case TC.Pr_InPr:
                    newOperator.SetRole(TT.Pre);
                    if (!topOperator.od.HasValidArg(newOperator.od, out msg))
                    {
                        IO.Error(msg);
                    }
                    break;

                case TC.Po_InPr:
                    newOperator.SetRole(TT.In);
                    if (!newOperator.od.HasValidLeftArg(topOperator.od, out msg))
                    {
                        IO.Error(msg);
                    }
                    break;

                case TC.InPo_Term:
                    topOperator.SetRole(TT.In);
                    if (!topOperator.od.HasValidLeftArg(topOperator.prevOd, out msg))
                    {
                        IO.Error(msg);
                    }
                    break;

                case TC.InPo_Pr:
                    topOperator.SetRole(TT.In);
                    if (!topOperator.od.HasValidLeftArg(topOperator.prevOd, out msg))
                    {
                        IO.Error(msg);
                    }
                    if (!topOperator.od.HasValidRightArg(newOperator.od, out msg))
                    {
                        IO.Error(msg);
                    }
                    break;

                case TC.InPo_In:
                    topOperator.SetRole(TT.Post);
                    if (!topOperator.od.HasValidArg(topOperator.prevOd, out msg))
                    {
                        IO.Error(msg);
                    }
                    if (!newOperator.od.HasValidLeftArg(topOperator.od, out msg))
                    {
                        IO.Error(msg);
                    }
                    break;

                case TC.InPo_Po:
                    topOperator.SetRole(TT.Post);
                    if (!topOperator.od.HasValidArg(topOperator.prevOd, out msg))
                    {
                        IO.Error(msg);
                    }
                    if (!newOperator.od.HasValidArg(topOperator.od, out msg))
                    {
                        IO.Error(msg);
                    }
                    break;

                case TC.InPo_InPr:
                    bool topInOpValid =
                        topOperator.triplet[TT.In].HasValidRightArg(newOperator.triplet[TT.Pre], out msg);
                    bool newInOpValid =
                        newOperator.triplet[TT.In].HasValidLeftArg(topOperator.triplet[TT.Post], out msg);
                    if (topInOpValid)
                    {
                        if (newInOpValid)
                        {
                            IO.Error("Ambiguous operator combination: '{0}' followed by '{1}'",
                                     topOperator.triplet, newOperator.triplet);
                        }
                        else
                        {
                            topOperator.SetRole(TT.In);
                            newOperator.SetRole(TT.Pre);
                        }
                    }
                    else
                    {
                        topOperator.SetRole(TT.Post);
                        newOperator.SetRole(TT.In);
                    }
                    break;

                case TC.InPo_InPo:
                case TC.InPo_EoS:
                    topOperator.SetRole(TT.Post);
                    if (!ProcessIfStandAloneOperator())
                    {
                        if (!topOperator.od.HasValidArg(topOperator.prevOd, out msg))
                        {
                            IO.Error(msg);
                        }
                    }
                    break;

                default:
                    IO.Fatal("TokenCombi case '{0}' not covered", combi);
                    break;
                }
            }
コード例 #16
0
        protected void OnGUI()
        {
            if (workingAnimation == null)
            {
                this.Close();
                return;
            }

            switch (Event.current.type)
            {
            case EventType.DragUpdated:
                if (DragAndDrop.paths != null && DragAndDrop.paths.Length > 0)
                {
                    DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
                    Debug.Log("Dragging (" + Event.current.type + "):" + System.String.Join("\n", DragAndDrop.paths));
                }
                break;

            case EventType.DragPerform:
                if (DragAndDrop.paths != null && DragAndDrop.paths.Length > 0)
                {
                    DragAndDrop.AcceptDrag();
                    foreach (var path in DragAndDrop.paths)
                    {
                        var uri   = AssetsController.AddSingleAsset(AssetsConstants.CATEGORY_ANIMATION_IMAGE, path);
                        var frame = workingAnimation.addFrame(selectedFrame, null);
                        frame.setUri(uri);
                    }
                }
                break;
            }

            EditorGUILayout.PrefixLabel(TC.get("Animation.GeneralInfo"), GUIStyle.none, titleStyle);
            EditorGUI.BeginChangeCheck();
            var documentationTextContent = EditorGUILayout.TextField(TC.get("Animation.Documentation"), workingAnimation.getDocumentation());

            if (EditorGUI.EndChangeCheck())
            {
                workingAnimation.setDocumentation(documentationTextContent);
            }

            EditorGUI.BeginChangeCheck();
            var useTransitions = EditorGUILayout.Toggle(TC.get("Animation.UseTransitions"), workingAnimation.isUseTransitions());

            if (EditorGUI.EndChangeCheck())
            {
                workingAnimation.setUseTransitions(useTransitions);
            }

            EditorGUI.BeginChangeCheck();
            var isSlides = EditorGUILayout.Toggle(TC.get("Animation.Slides"), workingAnimation.isSlides());

            if (EditorGUI.EndChangeCheck())
            {
                workingAnimation.setSlides(isSlides);
            }

            /*
             * Transition panel
             */
            EditorGUILayout.PrefixLabel(TC.get("Animation.Timeline"), GUIStyle.none, titleStyle);

            using (var scroll = new EditorGUILayout.ScrollViewScope(scrollPosition, true, false, GUILayout.Height(125)))
                using (new EditorGUILayout.HorizontalScope())
                    using (new GUIUtil.SkinScope(noBackgroundSkin))
                    {
                        scrollPosition = scroll.scrollPosition;
                        for (int i = 0, frameCount = workingAnimation.getFrames().Count; i < frameCount; i++)
                        {
                            if (selectedFrame == i)
                            {
                                GUI.skin = selectedFrameSkin;
                            }

                            var frame        = workingAnimation.getFrame(i);
                            var image        = Controller.ResourceManager.getImage(frame.getUri());
                            var frameContent = new GUIContent(frame.getTime().ToString(), image);
                            if (GUILayout.Button(frameContent, GUILayout.Height(100), GUILayout.Width(80)))
                            {
                                selectedFrame = (i == selectedFrame) ? -1 : i;
                                GUI.FocusControl(null);
                            }
                            if (useTransitions && i != workingAnimation.getFrames().Count - 1)
                            {
                                var transition        = workingAnimation.getTranstionForFrame(i);
                                var transitionContent = new GUIContent(transition.getTime().ToString(), transitionTypeTexture[(int)transition.getType()]);
                                if (GUILayout.Button(transitionContent, GUILayout.Height(100), GUILayout.Width(80)))
                                {
                                    selectedFrame = (i == selectedFrame) ? -1 : i;
                                    GUI.FocusControl(null);
                                }
                            }
                            GUI.skin = noBackgroundSkin;
                        }
                    }

            /*
             * Transition button panel
             */
            using (new EditorGUILayout.HorizontalScope())
                using (new GUIUtil.SkinScope(noBackgroundSkin))
                {
                    GUILayout.FlexibleSpace();
                    using (new EditorGUI.DisabledScope(selectedFrame < 0))
                    {
                        if (GUILayout.Button(moveLeft))
                        {
                            workingAnimation.moveLeft(selectedFrame);
                            selectedFrame--;
                        }
                    }
                    using (new EditorGUI.DisabledScope(selectedFrame < 0 || workingAnimation.getFrames().Count < 2))
                    {
                        if (GUILayout.Button(clearImg))
                        {
                            workingAnimation.removeFrame(selectedFrame);
                            selectedFrame--;
                        }
                    }

                    if (GUILayout.Button(addTexture))
                    {
                        var frame = workingAnimation.addFrame(selectedFrame, null);
                        frame.setUri(SpecialAssetPaths.ASSET_EMPTY_ANIMATION + "_01.png");
                    }

                    using (new EditorGUI.DisabledScope(selectedFrame < 0))
                    {
                        if (GUILayout.Button(duplicateImg))
                        {
                            workingAnimation.addFrame(selectedFrame, workingAnimation.getFrame(selectedFrame));
                        }
                    }

                    using (new EditorGUI.DisabledScope(selectedFrame >= workingAnimation.getFrames().Count - 1))
                    {
                        if (GUILayout.Button(moveRight))
                        {
                            workingAnimation.moveRight(selectedFrame);
                            selectedFrame++;
                        }
                    }
                    GUILayout.FlexibleSpace();
                }


            using (new EditorGUI.DisabledScope(selectedFrame == -1))
            {/*
              * Frame info panel
              */
                var frame = selectedFrame >= 0 ? workingAnimation.getFrame(selectedFrame): emptyFrame;

                EditorGUILayout.PrefixLabel(TC.get("Animation.Details"), GUIStyle.none, titleStyle);

                EditorGUI.BeginChangeCheck();
                var frameDocumentation = EditorGUILayout.TextField(TC.get("Animation.Documentation"), frame.getDocumentation());
                if (EditorGUI.EndChangeCheck())
                {
                    frame.setDocumentation(frameDocumentation);
                }

                EditorGUI.BeginChangeCheck();
                var frameDuration = System.Math.Max(0, EditorGUILayout.LongField(TC.get("Animation.Duration"), frame.getTime()));
                if (EditorGUI.EndChangeCheck())
                {
                    frame.setTime(frameDuration);
                }

                EditorGUI.BeginChangeCheck();
                imageChooser.Path = frame.getUri();
                imageChooser.DoLayout();
                if (EditorGUI.EndChangeCheck())
                {
                    frame.setUri(imageChooser.Path);
                }

                EditorGUI.BeginChangeCheck();
                soundChooser.Path = frame.getSoundUri();
                soundChooser.DoLayout();
                if (EditorGUI.EndChangeCheck())
                {
                    frame.setSoundUri(soundChooser.Path);
                }

                var editTransition = useTransitions && selectedFrame.InRange(-1, workingAnimation.getFrames().Count - 1);
                var transition     = editTransition ? workingAnimation.getTranstionForFrame(selectedFrame) : emptyTransition;

                using (new EditorGUI.DisabledScope(!editTransition))
                {
                    EditorGUILayout.PrefixLabel(TC.get("NextScene.Transition"), GUIStyle.none, titleStyle);
                    EditorGUI.BeginChangeCheck();
                    var transitionDuration = EditorGUILayout.LongField(TC.get("Animation.Duration"), transition.getTime());
                    if (EditorGUI.EndChangeCheck())
                    {
                        transition.setTime(transitionDuration);
                    }

                    EditorGUI.BeginChangeCheck();
                    var transitionType = EditorGUILayout.Popup(TC.get("Conditions.Type"), (int)transition.getType(), transitionTypeName);
                    if (EditorGUI.EndChangeCheck())
                    {
                        transition.setType((TransitionType)transitionType);
                    }
                }
            }

            var lastEditorRect = GUILayoutUtility.GetLastRect();


            // Ending buttons
            GUILayout.FlexibleSpace();
            using (new EditorGUILayout.HorizontalScope())
            {
                if (GUILayout.Button("OK"))
                {
                    // If it doesnt have an extension its because its an old animation
                    if (!Path.HasExtension(cutscenePath))
                    {
                        cutscenePath = cutscenePath + ".eaa.xml";
                    }

                    AnimationWriter.WriteAnimation(cutscenePath, workingAnimation);
                    AssetDatabase.Refresh(ImportAssetOptions.Default);
                    if (reference != null)
                    {
                        reference.OnDialogOk(cutscenePath, this);
                    }
                    this.Close();
                }
                if (GUILayout.Button(TC.get("GeneralText.Cancel")))
                {
                    if (reference != null)
                    {
                        reference.OnDialogCanceled();
                    }
                    this.Close();
                }
            }

            if (Event.current.type == EventType.Repaint)
            {
                var lastButtonRect = GUILayoutUtility.GetLastRect();
                var minheight      = lastEditorRect.y + lastEditorRect.height + lastEditorRect.height + 10;
                minSize = new Vector2(400, minheight);
            }
        }
コード例 #17
0
        public override bool doTool()
        {
            bool elementDeleted = false;

            // Delete the block only if it is not the last one
            lastSelectedResources = parentDataControl.getSelectedResources();
            if (resourcesList.Count > 1)
            {
                if (resourcesList.Remove((ResourcesUni)dataControl.getContent()))
                {
                    resourcesIndex = resourcesDataControlList.IndexOf((ResourcesDataControl)dataControl);
                    resourcesDataControlList.Remove((ResourcesDataControl)dataControl);

                    int selectedResources = parentDataControl.getSelectedResources();
                    // Decrease the selected index if necessary
                    if (selectedResources > 0 && selectedResources >= resourcesIndex)
                    {
                        parentDataControl.setSelectedResources(selectedResources - 1);
                    }

                    //controller.dataModified( );
                    elementDeleted = true;
                }
            }

            // If it was the last one, show an error message
            else
            {
                Controller.getInstance().showErrorDialog(TC.get("Operation.DeleteResourcesTitle"), TC.get("Operation.DeleteResourcesErrorLastResources"));
            }

            return(elementDeleted);
        }
コード例 #18
0
        void OnGUI()
        {
            var windowWidth  = position.width;
            var windowHeight = position.height;

            contentRect         = new Rect(0f, 0.1f * windowHeight, windowWidth, 0.7f * windowHeight);
            addDeleteButtonRect = new Rect(0f, 0.8f * windowHeight, windowWidth, 0.15f * windowHeight);

            /*
             * Upper buttons
             */
            GUILayout.BeginHorizontal();
            if (openedWindow == WindowType.FLAGS)
            {
                GUI.skin = selectedButtonSkin;
            }
            if (GUILayout.Button(flagContent, GUILayout.MaxHeight(0.08f * windowHeight)))
            {
                if (openedWindow == WindowType.VARS)
                {
                    OnWindowTypeChanged();
                }
            }
            GUI.skin = defaultSkin;

            if (openedWindow == WindowType.VARS)
            {
                GUI.skin = selectedButtonSkin;
            }
            if (GUILayout.Button(varContent, GUILayout.MaxHeight(0.08f * windowHeight)))
            {
                if (openedWindow == WindowType.FLAGS)
                {
                    OnWindowTypeChanged();
                }
            }
            GUI.skin = defaultSkin;
            GUILayout.EndHorizontal();

            /*
             * Content part
             */
            GUILayout.BeginArea(contentRect);
            GUILayout.Space(10);
            if (openedWindow == WindowType.FLAGS)
            {
                GUILayout.Label(TC.get("Flags.Title"));
                GUILayout.BeginHorizontal();
                GUILayout.Box(TC.get("Flags.FlagName"), GUILayout.Width(0.7f * windowWidth));
                GUILayout.Box(TC.get("Flags.FlagReferences"), GUILayout.Width(0.25f * windowWidth));
                GUILayout.EndHorizontal();

                scrollPosition = GUILayout.BeginScrollView(scrollPosition);
                for (int i = 0; i < Controller.getInstance().getVarFlagSummary().getFlagCount(); i++)
                {
                    GUILayout.BeginHorizontal();
                    if (selectedObject == i)
                    {
                        GUI.skin = selectedAreaSkin;
                    }
                    else
                    {
                        GUI.skin = noBackgroundSkin;
                    }

                    if (GUILayout.Button(Controller.getInstance().getVarFlagSummary().getFlag(i),
                                         GUILayout.Width(0.7f * windowWidth)))
                    {
                        OnSelectedObjectChange(i);
                    }

                    if (GUILayout.Button(Controller.getInstance().getVarFlagSummary().getFlagReferences(i).ToString(),
                                         GUILayout.Width(0.25f * windowWidth)))
                    {
                        OnSelectedObjectChange(i);
                    }
                    GUI.skin = defaultSkin;
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndScrollView();
            }
            else
            {
                GUILayout.Label(TC.get("Vars.Title"));
                GUILayout.BeginHorizontal();
                GUILayout.Box(TC.get("Vars.VarName"), GUILayout.Width(0.7f * windowWidth));
                GUILayout.Box(TC.get("Vars.VarReferences"), GUILayout.Width(0.25f * windowWidth));
                GUILayout.EndHorizontal();

                scrollPosition = GUILayout.BeginScrollView(scrollPosition);
                for (int i = 0; i < Controller.getInstance().getVarFlagSummary().getVarCount(); i++)
                {
                    GUILayout.BeginHorizontal();
                    if (selectedObject == i)
                    {
                        GUI.skin = selectedAreaSkin;
                    }
                    else
                    {
                        GUI.skin = noBackgroundSkin;
                    }

                    if (GUILayout.Button(Controller.getInstance().getVarFlagSummary().getVar(i),
                                         GUILayout.Width(0.7f * windowWidth)))
                    {
                        OnSelectedObjectChange(i);
                    }

                    if (GUILayout.Button(Controller.getInstance().getVarFlagSummary().getVarReferences(i).ToString(),
                                         GUILayout.Width(0.25f * windowWidth)))
                    {
                        OnSelectedObjectChange(i);
                    }
                    GUI.skin = defaultSkin;
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndScrollView();
            }
            GUILayout.EndArea();


            /*
             * Add/delete part
             */
            GUILayout.BeginArea(addDeleteButtonRect);
            if (openedWindow == WindowType.FLAGS)
            {
                if (GUILayout.Button(TC.get("Flags.AddFlag")))
                {
                    OnAddCliked();
                }

                if (GUILayout.Button(TC.get("Flags.DeleteFlag")))
                {
                    OnDeleteClicked();
                }
            }
            else
            {
                if (GUILayout.Button(TC.get("Vars.AddVar")))
                {
                    OnAddCliked();
                }

                if (GUILayout.Button(TC.get("Vars.DeleteVar")))
                {
                    OnDeleteClicked();
                }
            }
            GUILayout.EndArea();
        }
コード例 #19
0
        private void loadMainLineOutDevice(TC.DevcieManager devMgr)
        {
            lines.Clear();

               foreach (DeviceBaseWrapper dev in devMgr.getOutputDeviceEnum())
               {

                   if (!lines.Contains(dev.lineid + "-" + dev.direction))
                   {
                       lines.Add(dev.lineid + "-" + dev.direction, ArrayList.Synchronized(new System.Collections.ArrayList()));
                      // lineJamRanges.Add(dev.lineid + "-" + dev.direction, ArrayList.Synchronized(new System.Collections.ArrayList()));
                   }

                   //if (dev.location == "F" || dev.location == "H" || dev.location == "T")
                   //{
                       ((ArrayList)lines[dev.lineid + "-" + dev.direction]).Add(dev);
                   //}

               }
               System.Collections.Hashtable hsInters = new Hashtable();
               System.Data.Odbc.OdbcConnection cn = new System.Data.Odbc.OdbcConnection(Global.Db2ConnectionString);
               System.Data.Odbc.OdbcCommand cmd = new System.Data.Odbc.OdbcCommand("Select divisiontype,lineid1,direction1,mileage1,lineid2,direction2,mileage2 from vwcloverleaf");
               cmd.Connection = cn;
               try
               {
               cn.Open();
               System.Data.Odbc.OdbcDataReader rd = cmd.ExecuteReader();
               while (rd.Read())
               {
                   try
                   {
                       string divisionType, lineid1, direction1, lineid2, direction2;
                       int mileage1, mileage2;
                       divisionType = rd[0].ToString();
                       lineid1 = rd[1].ToString();
                       direction1 = rd[2].ToString();
                       mileage1 = System.Convert.ToInt32(rd[3]);
                       if (divisionType == "C") //系統交流道
                       {
                           lineid2 = rd[4].ToString();
                           direction2 = rd[5].ToString();
                           mileage2 = System.Convert.ToInt32(rd[6]);
                       }
                       else  //匝道
                       {
                           lineid2 = lineid1;
                           direction2 = direction1;
                           mileage2 = mileage1;

                       }
                       InterSection intersec = new InterSection(divisionType, lineid1, direction1, mileage1, lineid2, direction2, mileage2);

                       if (!hsInters.Contains(intersec.getDevName()))
                       {
                           hsInters.Add(intersec.getDevName(), intersec);
                           try
                           {
                               ((ArrayList)lines[intersec.getLineID() + "-" + intersec.getDirection()]).Add(intersec);
                           }
                           catch (Exception ex2)
                           {
                               ConsoleServer.WriteLine(ex2.Message + "," + ex2.StackTrace);
                           }

                       }
                       else if (intersec.getDevType() == "C")
                       {
                           ((InterSection)hsInters[intersec.getDevName()]).BranchName2 = intersec.BranchName1;
                       }

                       //if (lines.Contains(lineid1 + "-" + direction1))
                       //{

                       //}

                   }
                   catch (Exception ex1)
                   {
                       ConsoleServer.WriteLine(ex1.Message + "," + ex1.StackTrace);
                   }

               }
               }
               catch (Exception ex)
               {
               ConsoleServer.WriteLine(ex.Message + "," + ex.StackTrace);
               }
               finally
               {

               cn.Close();
               }

               IDictionaryEnumerator iesec = hsInters.GetEnumerator();

               while (iesec.MoveNext())
               {
               try
               {
                   InterSection sec = (InterSection)iesec.Value;
                   if (sec.type == "C")
                   {
                       sec.branch1 = (InterSection)hsInters[sec.BranchName1];
                       sec.branch2 = (InterSection)hsInters[sec.BranchName2];
                   }
               }
               catch (Exception ex)
               {
                   ConsoleServer.WriteLine(ex.Message + "," + ex.StackTrace);
               }
               }

               IDictionaryEnumerator ie = lines.GetEnumerator();  //取得所有的路線
               while (ie.MoveNext())
               {
               ((ArrayList)ie.Value).Sort();   //排序所有的車輛偵測器

               ArrayList list = (ArrayList)ie.Value;
               //if (list.Count == 1)
               //    (vdlist[0] as DeviceBaseWrapper).AryInx = 0;

               // 填上前後車輛偵測器鏈結
              // if (list.Count > 1)
                   for (int i = 0; i < list.Count; i++)
                   {
                      // ((DeviceBaseWrapper)vdlist[i]).AryInx = i;

                       if (i == 0)
                           ((I_Positionable)list[i]).setNextDev( list[i + 1] as I_Positionable);
                       else if (i == list.Count - 1)
                           ((I_Positionable)list[i]).setPreDev( list[i - 1] as I_Positionable);
                       else
                       {
                           ((I_Positionable)list[i]).setPreDev( list[i - 1] as I_Positionable);
                           ((I_Positionable)list[i]).setNextDev( list[i + 1] as I_Positionable);
                       }

                   }

               }

               // oneMinTmr.Elapsed += new System.Timers.ElapsedEventHandler(oneMinTmr_Elapsed);
               // oneMinTmr.Start();
               //oneMinTmr = new System.Threading.Timer(new System.Threading.TimerCallback(oneMinTmr_Elapsed));
               //oneMinTmr.Change(0, 60 * 1000);

               ConsoleServer.WriteLine("設備收尋管理啟動完成!");
        }
コード例 #20
0
 public OutputDevicFetchManager(TC.DevcieManager devMgr)
 {
     loadMainLineOutDevice(devMgr);
 }
コード例 #21
0
 public override void recursiveSearch()
 {
     check(getCustomizedCursor(), TC.get("Cursor.exit.Description"));
     check(getCustomizedText(), TC.get("Search.CustomizedText"));
     check(getSoundPath(), TC.get("Animation.Sound"));
 }
コード例 #22
0
    void OnGUI()
    {
        /*
         * Documentation area
         */
        GUILayout.BeginArea(animInfoRect);

        GUILayout.BeginVertical();
        GUILayout.Label(TC.get("Animation.Documentation"));
        GUILayout.Space(5);
        documentationTextContent = GUILayout.TextField(documentationTextContent);
        GUILayout.EndVertical();

        GUILayout.BeginVertical();
        useTransitonFlag = GUILayout.Toggle(useTransitonFlag, TC.get("Animation.UseTransitions"));
        if (useTransitonFlag != useTransitonFlagLast)
        {
            OnUseTransitonFlagLastChanged(useTransitonFlag);
        }
        slidesAnimationFlag = GUILayout.Toggle(slidesAnimationFlag, TC.get("Animation.Slides"));
        if (slidesAnimationFlag != slidesAnimationFlagLast)
        {
            OnSlidesAnimationFlagLastChanged(slidesAnimationFlag);
        }
        GUILayout.EndVertical();

        GUILayout.EndArea();

        /*
         * Transition panel
         */
        GUILayout.BeginArea(timelineRect);
        scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false), GUILayout.MaxHeight(0.25f * windowWidth));
        GUI.skin       = noBackgroundSkin;
        GUILayout.BeginHorizontal();
        for (int i = 0; i < workingAnimation.getFrames().Count; i++)
        {
            GUILayout.BeginHorizontal();
            if (selectedFrame == i)
            {
                GUI.skin = selectedFrameSkin;
            }

            if (
                GUILayout.Button(
                    workingAnimation.getFrames()[i].getImage(false, false, global::Animation.ENGINE).texture, GUILayout.MaxHeight(0.2f * windowHeight), GUILayout.MaxWidth(0.2f * windowWidth)))
            {
                OnFrameSelectionChanged(i);
            }
            GUI.skin = noBackgroundSkin;
            GUILayout.EndHorizontal();
        }
        GUI.skin = defaultSkin;
        GUILayout.EndHorizontal();
        GUILayout.EndScrollView();
        GUILayout.EndArea();


        /*
         * Transition button panel
         */
        GUILayout.BeginArea(timelineButtonsRect);
        GUILayout.BeginHorizontal();
        GUI.skin = noBackgroundSkin;
        if (GUILayout.Button(moveLeft))
        {
            workingAnimation.moveLeft(selectedFrame);
        }
        if (GUILayout.Button(clearImg))
        {
            if (selectedFrame >= 0)
            {
                workingAnimation.removeFrame(selectedFrame);
                selectedFrame--;
            }
        }
        if (GUILayout.Button(addTexture))
        {
            workingAnimation.addFrame(selectedFrame, null);
        }
        if (GUILayout.Button(duplicateImg))
        {
            workingAnimation.addFrame(selectedFrame, workingAnimation.getFrame(selectedFrame));
        }
        if (GUILayout.Button(moveRight))
        {
            workingAnimation.moveRight(selectedFrame);
        }
        GUI.skin = defaultSkin;
        GUILayout.EndHorizontal();
        GUILayout.EndArea();


        /*
         * Frame info panel
         */
        GUILayout.BeginArea(frameInfoRect);

        GUILayout.BeginHorizontal();
        GUILayout.Label(TC.get("Animation.Duration"));
        animationDurationString = GUILayout.TextField(animationDurationString);
        animationDurationString = (Regex.Match(animationDurationString, "^[0-9]{1,4}$").Success
            ? animationDurationString
            : animationDurationStringLast);
        if (!animationDurationString.Equals(animationDurationStringLast))
        {
            OnFrameDurationChanged(animationDurationString);
        }
        GUILayout.Space(5);
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label(TC.get("Animation.Image"));
        GUILayout.Box(imagePath, GUILayout.MinWidth(0.3f * windowWidth));
        if (GUILayout.Button(TC.get("Buttons.Select")))
        {
            ImageFileOpenDialog imageDialog =
                (ImageFileOpenDialog)ScriptableObject.CreateInstance(typeof(ImageFileOpenDialog));
            imageDialog.Init(this, BaseFileOpenDialog.FileType.FRAME_IMAGE);
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label(TC.get("Animation.Sound"));
        GUILayout.Space(5);
        if (GUILayout.Button(clearImg))
        {
        }
        GUILayout.Box(soundPath, GUILayout.MinWidth(0.3f * windowWidth));
        if (GUILayout.Button(TC.get("Buttons.Select")))
        {
            MusicFileOpenDialog musicDialog =
                (MusicFileOpenDialog)ScriptableObject.CreateInstance(typeof(MusicFileOpenDialog));
            musicDialog.Init(this, BaseFileOpenDialog.FileType.FRAME_MUSIC);
        }
        GUILayout.EndHorizontal();
        GUILayout.Space(20);
        GUILayout.BeginHorizontal();
        GUILayout.Label(TC.get("NextScene.Transition") + " " + TC.get("Animation.Duration"));
        transitionDurationString = GUILayout.TextField(transitionDurationString);
        transitionDurationString = (Regex.Match(transitionDurationString, "^[0-9]{1,4}$").Success
            ? transitionDurationString
            : transitionDurationStringLast);
        if (!transitionDurationString.Equals(transitionDurationStringLast))
        {
            OnTransitionDurationChanged(transitionDurationString);
        }
        GUILayout.EndHorizontal();
        GUILayout.EndArea();


        GUILayout.BeginArea(buttonRect);
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("OK"))
        {
            AnimationWriter.writeAnimation(cutscenePath, workingAnimation);
            reference.OnDialogOk("", this);
            this.Close();
        }
        if (GUILayout.Button(TC.get("GeneralText.Cancel")))
        {
            reference.OnDialogCanceled();
            this.Close();
        }
        GUILayout.EndHorizontal();
        GUILayout.EndArea();
    }
コード例 #23
0
    public void Awake()
    {
        resourcesEditor = new ResourcesEditor {
            ShowResourcesList = true
        };
        conditionsTex   = Resources.Load <Texture2D>("EAdventureData/img/icons/conditions-24x24");
        noConditionsTex = Resources.Load <Texture2D>("EAdventureData/img/icons/no-conditions-24x24");

        actionsList = new DataControlList()
        {
            footerHeight  = 25,
            elementHeight = 40,
            Columns       = new System.Collections.Generic.List <ColumnList.Column>()
            {
                new ColumnList.Column()
                {
                    Text        = TC.get("ActionsList.ActionName"),
                    SizeOptions = new GUILayoutOption[] { GUILayout.Width(150) }
                },
                new ColumnList.Column()
                {
                    Text        = TC.get("DescriptionList.Description"),
                    SizeOptions = new GUILayoutOption[] { GUILayout.ExpandWidth(true) }
                },
                new ColumnList.Column()
                {
                    Text        = TC.get("ActionsList.NeedsGoTo"),
                    SizeOptions = new GUILayoutOption[] { GUILayout.Width(120) }
                },
                new ColumnList.Column()
                {
                    Text        = TC.get("ActionsList.Conditions"),
                    SizeOptions = new GUILayoutOption[] { GUILayout.Width(70) }
                },
                new ColumnList.Column()
                {
                    Text        = TC.get("Element.Effects"),
                    SizeOptions = new GUILayoutOption[] { GUILayout.Width(70) }
                }
            },
            drawCell = (rect, index, column, isActive, isFocused) =>
            {
                var action = actionsList.list[index] as ActionDataControl;
                switch (column)
                {
                case 0:
                {
                    var name = action.getContent() is CustomAction ? ((CustomAction)action.getContent()).getName() : action.getTypeName();

                    var leftHalf = new Rect(rect);
                    leftHalf.width /= 2f;
                    var rightHalf = new Rect(leftHalf);
                    rightHalf.x += leftHalf.width;

                    if (action.hasIdTarget())
                    {
                        rightHalf.height = 25;
                        EditorGUI.LabelField(leftHalf, name);
                        if (!isActive)
                        {
                            EditorGUI.LabelField(rightHalf, !string.IsNullOrEmpty(action.getIdTarget()) ? action.getIdTarget() : "---");
                        }
                        else
                        {
                            EditorGUI.BeginChangeCheck();
                            string   selected = string.Empty;
                            string[] choices  = new string[0];
                            switch ((action.getContent() as Action).getType())
                            {
                            case Action.DRAG_TO:
                            case Action.CUSTOM_INTERACT:
                                choices = Controller.Instance.IdentifierSummary.combineIds(new System.Type[] { typeof(Item), typeof(NPC), typeof(ActiveArea) });
                                break;

                            case Action.GIVE_TO:
                                choices = Controller.Instance.IdentifierSummary.getIds <NPC>();
                                break;

                            case Action.USE_WITH:
                                choices = Controller.Instance.IdentifierSummary.combineIds(new System.Type[] { typeof(Item), typeof(ActiveArea) });
                                break;
                            }

                            var selectedIndex = EditorGUI.Popup(rightHalf, System.Array.FindIndex(choices, action.getIdTarget().Equals), choices);
                            if (EditorGUI.EndChangeCheck())
                            {
                                if (selectedIndex >= 0 && selectedIndex < choices.Length)
                                {
                                    selected = choices[selectedIndex];
                                    action.setIdTarget(selected);
                                }
                            }
                        }
                    }
                    else if (action.getType() == Controller.ACTION_TALK_TO)
                    {
                        EditorGUI.LabelField(leftHalf, name);
                        var triggerConversationEffect = action.getEffects().getEffects().Find(e => e is TriggerConversationEffect) as TriggerConversationEffect;
                        if (triggerConversationEffect != null)
                        {
                            var conversationId = triggerConversationEffect.getTargetId();
                            if (GUI.Button(rightHalf, "Open"))
                            {
                                var conversationsList = Controller.Instance.SelectedChapterDataControl.getConversationsList();
                                var conversation      = conversationsList.getConversations().Find(c => c.getId() == conversationId);
                                Controller.Instance.SelectElement(conversation);
                            }
                        }
                    }
                    else
                    {
                        EditorGUI.LabelField(rect, name);
                    }
                }
                break;

                case 1:
                    EditorGUI.BeginChangeCheck();
                    var documentation = EditorGUI.TextArea(rect, action.getDocumentation() ?? string.Empty);
                    if (EditorGUI.EndChangeCheck())
                    {
                        action.setDocumentation(documentation);
                    }
                    break;

                case 2:
                    if (Controller.Instance.PlayerMode == Controller.FILE_ADVENTURE_1STPERSON_PLAYER)
                    {
                        EditorGUI.LabelField(rect, TC.get("ActionsList.NotRelevant"));
                    }
                    else
                    {
                        var leftHalf = new Rect(rect);
                        leftHalf.width /= 2f;
                        var rightHalf = new Rect(leftHalf);
                        rightHalf.x += leftHalf.width;

                        EditorGUI.BeginChangeCheck();
                        var needsToGo = EditorGUI.Toggle(leftHalf, action.getNeedsGoTo());
                        if (EditorGUI.EndChangeCheck())
                        {
                            action.setNeedsGoTo(needsToGo);
                        }

                        EditorGUI.BeginChangeCheck();
                        var distance = EditorGUI.IntField(rightHalf, action.getKeepDistance());
                        if (EditorGUI.EndChangeCheck())
                        {
                            action.setKeepDistance(distance);
                        }
                        ;
                    }
                    break;

                case 3:
                    if (GUI.Button(rect, action.getConditions().getBlocksCount() > 0 ? conditionsTex : noConditionsTex))
                    {
                        ConditionEditorWindow window = ScriptableObject.CreateInstance <ConditionEditorWindow>();
                        window.Init(action.getConditions());
                    }
                    break;

                case 4:
                    if (GUI.Button(rect, "Effects"))
                    {
                        EffectEditorWindow window = ScriptableObject.CreateInstance <EffectEditorWindow>();
                        window.Init(action.getEffects());
                    }
                    break;
                }
            }
        };

        actionsList.onSelectCallback += (list) =>
        {
            var i       = list.index;
            var actions = ActionsListDataControl.getActions();
            customAction = i != -1 && actions[i] is CustomActionDataControl ? actions[i] as CustomActionDataControl : null;
            if (customAction != null)
            {
                resourcesEditor.Data = customAction;
            }
        };

        actionsList.onRemoveCallback += (list) =>
        {
            customAction = null;
        };
    }
コード例 #24
0
    public BooksWindow(Rect aStartPos, GUIContent aContent, GUIStyle aStyle, params GUILayoutOption[] aOptions)
        : base(aStartPos, aContent, aStyle, aOptions)
    {
        booksWindowAppearance    = new BooksWindowAppearance(aStartPos, new GUIContent(TC.get("Book.App")), "Window");
        booksWindowContents      = new BooksWindowContents(aStartPos, new GUIContent(TC.get("Book.Contents")), "Window");
        booksWindowDocumentation = new BooksWindowDocumentation(aStartPos, new GUIContent(TC.get("Book.Documentation")), "Window");

        windowWidth  = aStartPos.width;
        windowHeight = aStartPos.height;

        thisRect           = aStartPos;
        selectedButtonSkin = (GUISkin)Resources.Load("Editor/ButtonSelected", typeof(GUISkin));
    }
コード例 #25
0
        public void Init(DialogReceiverInterface e, string cutsceneFilePath)
        {
            parent = e;

            windowWidth  = 800;
            windowHeight = 1000;

            cutscenePath = cutsceneFilePath;
            clearImg     = Resources.Load <Texture2D>("EAdventureData/img/icons/deleteContent");
            addTexture   = Resources.Load <Texture2D>("EAdventureData/img/icons/addNode");
            moveLeft     = Resources.Load <Texture2D>("EAdventureData/img/icons/moveNodeLeft");
            moveRight    = Resources.Load <Texture2D>("EAdventureData/img/icons/moveNodeRight");
            duplicateImg = Resources.Load <Texture2D>("EAdventureData/img/icons/duplicateNode");

            noBackgroundSkin  = Resources.Load <GUISkin>("EAdventureData/skin/EditorNoBackgroundSkin");
            selectedFrameSkin = Resources.Load <GUISkin>("EAdventureData/skin/EditorLeftMenuItemSkinConcreteOptions");

            transitionTypeName = new string[]
            {
                TC.get("NextScene.NoTransition"),
                TC.get("NextScene.TopToBottom"),
                TC.get("NextScene.BottomToTop"),
                TC.get("NextScene.LeftToRight"),
                TC.get("NextScene.RightToLeft"),
                TC.get("NextScene.FadeIn")
            };
            transitionTypeTexture = new Texture2D[]
            {
                Resources.Load <Texture2D>("EAdventureData/img/icons/transitionNone"),
                Resources.Load <Texture2D>("EAdventureData/img/icons/transitionVertical"),
                Resources.Load <Texture2D>("EAdventureData/img/icons/transitionReverseVertical"),
                Resources.Load <Texture2D>("EAdventureData/img/icons/transitionHorizontal"),
                Resources.Load <Texture2D>("EAdventureData/img/icons/transitionReverseHorizontal"),
                Resources.Load <Texture2D>("EAdventureData/img/icons/transitionFadein"),
            };

            Debug.Log(cutsceneFilePath);

            var incidences = new List <Incidence>();

            if (Controller.Instance == null || !Controller.Instance.Initialized)
            {
                Controller.Instance.Init();
            }

            workingAnimation = Loader.LoadAnimation(cutsceneFilePath, Controller.ResourceManager, incidences) ?? new Animation(cutsceneFilePath, 40);

            imageChooser = new FileChooser
            {
                Empty    = SpecialAssetPaths.ASSET_EMPTY_IMAGE,
                FileType = FileType.FRAME_IMAGE,
                Label    = TC.get("Animation.Image")
            };

            soundChooser = new FileChooser
            {
                FileType = FileType.FRAME_MUSIC,
                Label    = TC.get("Animation.Sound")
            };

            // Initalize
            selectedFrame = -1;

            base.Init(e);
        }
コード例 #26
0
        void MediaViewer_ItemDisplayed(object sender, TC.CustomControls.MediaViewer.ItemDisplayedEventArgs e)
        {
            if (currentViewingQuestion != null)
            {
                currentViewingQuestion.ResultVisibilityChanged -= CurrentViewingQuestionOnResultVisibilityChanged;
                //currentViewingQuestion.IsResultVisible = false;
            }

            currentViewingQuestion = (VmQuestionContent)((IList)(MediaViewer.Items))[MediaViewer.DisplayedItemIndex];
            currentViewingQuestion.ResultVisibilityChanged += CurrentViewingQuestionOnResultVisibilityChanged;

            SetQuestionNumber(currentViewingQuestion.Question.Index);
            SetKeypointText(currentViewingQuestion.Question);
            SetQuestionResultImageIcon();
            //currentViewingQuestion.IsResultVisible = false;
        }
        public override bool addElement(int type, string id)
        {
            bool elementAdded = false;

            if (type == Controller.ACTIVE_AREA)
            {
                // Show a dialog asking for the item id
                if (string.IsNullOrEmpty(id))
                {
                    controller.ShowInputIdDialog(TC.get("Operation.AddActiveAreaTitle"), TC.get("Operation.AddActiveAreaMessage"),
                                                 Controller.Instance.makeElementValid(TC.get("Operation.AddActiveAreaDefaultValue")), performAddElement);
                }
                else
                {
                    performAddElement(null, id);
                    elementAdded = true;
                }
            }

            return(elementAdded);
        }
コード例 #28
0
 public DeleteNodeOptionTool(ConversationNodeView parent, int optionIndex) : base(parent)
 {
     this.confirmText  = TC.get("Conversation.ConfirmationDeleteOption");
     this.confirmTitle = TC.get("Conversation.OperationDeleteOption");
     this.linkIndex    = optionIndex;
 }
コード例 #29
0
 protected PCondIsObjectTypeQ(PrimitiveIsObjectTypeQ predicate, SCode consequent, SCode alternative)
     : base(predicate, consequent, alternative)
 {
     this.rand0Value =  predicate.rand0Value;
 }
コード例 #30
0
 public Column(TC headerElement, Func <TD, TC> getRowElementFunc)
 {
     this.headerElement     = headerElement;
     this.getRowElementFunc = getRowElementFunc;
 }
コード例 #31
0
 static SCode Rewrite(TC oldType, Primitive1 newPred, SCode arg)
 {
     Debug.Write ("\n; Flatten (object-type? =>  " + newPred.Name);
     return PrimitiveCombination1.Make (newPred, arg);
 }
コード例 #32
0
        public override void DrawPreview(Rect rect)
        {
            GUILayout.BeginHorizontal();
            if (Target != null && !IsPlayer)
            {
                var npc     = Target as NPCDataControl;
                var preview = GetCharacterTexturePreview(npc, NPC.RESOURCE_TYPE_STAND_DOWN);
                DrawSinglePreview(preview);
            }
            else
            {
                if (Target is NodeDataControl || IsPlayer)
                {
                    Target = Controller.Instance.SelectedChapterDataControl.getPlayer();
                }

                var npc = Target as NPCDataControl ?? workingCharacter;
                // Draw the animation selector for each animation in the selected resource group
                foreach (var resourceTypeGroup in resourceTypeGroups[selectedAnimationGroup])
                {
                    DrawSinglePreview(GetCharacterTexturePreview(npc, resourceTypeGroup.Value), TC.get(fieldNames[resourceTypeGroup.Key]));
                }
            }
            GUILayout.EndHorizontal();
        }
コード例 #33
0
    public override void Draw(int aID)
    {
        /*
         * View for videoscene
         */
        if (Controller.getInstance().getSelectedChapterDataControl().getCutscenesList().getCutscenes()[
                GameRources.GetInstance().selectedCutsceneIndex].isVideoscene())
        {
            // Background chooser
            GUILayout.Label(TC.get("Resources.DescriptionVideoscenes"));
            GUILayout.BeginHorizontal();
            if (GUILayout.Button(clearImg, GUILayout.Width(0.1f * windowWidth)))
            {
                OnVideosceneChanged("");
            }
            GUILayout.Box(videoscenePath, GUILayout.Width(0.6f * windowWidth));
            if (GUILayout.Button(TC.get("Buttons.Select"), GUILayout.Width(0.1f * windowWidth)))
            {
                ShowAssetChooser(AssetType.VIDEOSCENE);
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(30);

            GUILayout.Label(TC.get("Videoscene.Skip.border"));
            canSkipVideo = GUILayout.Toggle(canSkipVideo, new GUIContent(TC.get("Videoscene.Skip.label")));
            if (canSkipVideo != canSkipVideoLast)
            {
                OnVideosceneCanSkipVideoChanged(canSkipVideo);
            }
        }

        /*
         * View for slidescene
         */
        else
        {
            // Background chooser
            GUILayout.Label(TC.get("Resources.DescriptionSlidesceneSlides"));
            GUILayout.BeginHorizontal();
            if (GUILayout.Button(clearImg, GUILayout.Width(0.1f * windowWidth)))
            {
                OnSlidesceneChanged("");
            }
            GUILayout.Box(slidesPath, GUILayout.Width(0.6f * windowWidth));
            if (GUILayout.Button(TC.get("Buttons.Select"), GUILayout.Width(0.1f * windowWidth)))
            {
                ShowAssetChooser(AssetType.SELECT_SLIDES);
            }
            // Create/edit slidescene
            if (GUILayout.Button(TC.get("Resources.Create") + "/" + TC.get("Resources.Edit"), GUILayout.Width(0.2f * windowWidth)))
            {
                // For not-existing cutscene - show new cutscene name dialog
                if (slidesPath == null || slidesPath.Equals(""))
                {
                    CutsceneNameInputPopup createCutsceneDialog =
                        (CutsceneNameInputPopup)ScriptableObject.CreateInstance(typeof(CutsceneNameInputPopup));
                    createCutsceneDialog.Init(this, "");
                }
                else
                {
                    EditCutscene();
                }
            }
            GUILayout.EndHorizontal();

            // Music chooser
            GUILayout.BeginHorizontal();
            if (GUILayout.Button(clearImg, GUILayout.Width(0.1f * windowWidth)))
            {
                musicPath = "";
            }
            GUILayout.Box(musicPath, GUILayout.Width(0.7f * windowWidth));
            if (GUILayout.Button(TC.get("Buttons.Select"), GUILayout.Width(0.19f * windowWidth)))
            {
                ShowAssetChooser(AssetType.MUSIC);
            }
            GUILayout.EndHorizontal();
        }

        GUILayout.Space(30);

        GUILayout.Label(TC.get("ImageAssets.Preview"));
        if (Controller.getInstance().getSelectedChapterDataControl().getCutscenesList().getCutscenes()[
                GameRources.GetInstance().selectedCutsceneIndex].isVideoscene())
        {
            GUI.DrawTexture(previewRect, slidePreviewMovie, ScaleMode.ScaleToFit);
        }
        else
        {
            if (slidesPath != "")
            {
                GUI.DrawTexture(previewRect, slidesPreview, ScaleMode.ScaleToFit);
            }
        }
    }
コード例 #34
0
        public override bool addElement(int type, string id)
        {
            Action newAction = null;

            switch (type)
            {
            case Controller.ACTION_EXAMINE:
                newAction = new Action(Action.EXAMINE);

                break;

            case Controller.ACTION_USE:
                newAction = new Action(Action.USE);
                break;

            case Controller.ACTION_GRAB:
                var item = parent as ItemDataControl;
                newAction = new Action(Action.GRAB)
                {
                    Effects = new Effects()
                    {
                        new RemoveElementEffect(item.getId()),
                        new GenerateObjectEffect(item.getId())
                    }
                };
                break;

            case Controller.ACTION_TALK_TO:

                string[] conversations = controller.IdentifierSummary.getIds <Conversation>();
                if (id != null && conversations.Contains(id))
                {
                    newAction = new Action(Action.TALK_TO);
                    newAction.getEffects().Add(new TriggerConversationEffect(id));
                }
                else
                {
                    var options         = conversations.ToList();
                    var newConversation = "--- New ---";
                    options.Insert(0, newConversation);
                    controller.ShowInputDialog(TC.get("TalkToAction.MessageSelectConversation"), TC.get("TalkToAction.MessageSelectConversation"), options.ToArray(), (nothing, conversationId) =>
                    {
                        var action = new Action(Action.TALK_TO);
                        if (conversationId == newConversation)
                        {
                            var conversationList = controller.SelectedChapterDataControl.getConversationsList();
                            conversationList.addElement(Controller.CONVERSATION_GRAPH, null, false, this, (sender, newConversationId) =>
                            {
                                action.getEffects().Add(new TriggerConversationEffect(newConversationId));
                                performAddAction(action);
                                if (controller.ShowStrictConfirmDialog("Open conversation?", "Do you want to open the new conversation?"))
                                {
                                    controller.SelectElement(conversationList.getConversations().Last());
                                }
                            });
                        }
                        else
                        {
                            action.getEffects().Add(new TriggerConversationEffect(conversationId));
                            performAddAction(action);
                        }
                    });
                    return(true);
                }

                break;

            // For these tree the creation pipeline is the same
            case Controller.ACTION_USE_WITH:
            case Controller.ACTION_DRAG_TO:
            case Controller.ACTION_GIVE_TO:

                string        message    = "";
                int           actionType = -1;
                System.Type[] validTypes = { };

                // Select the elements, the action, and the popup message
                switch (type)
                {
                case Controller.ACTION_DRAG_TO:
                    validTypes = new System.Type[] { typeof(Item), typeof(ActiveArea), typeof(NPC) };
                    actionType = Action.DRAG_TO;
                    message    = TC.get("CustomAction.MessageSelectInteraction");
                    break;

                case Controller.ACTION_USE_WITH:
                    validTypes = new System.Type[] { typeof(Item), typeof(ActiveArea) };
                    actionType = Action.USE_WITH;
                    message    = TC.get("Action.MessageSelectItem");
                    break;

                case Controller.ACTION_GIVE_TO:
                    validTypes = new System.Type[] { typeof(NPC) };
                    message    = TC.get("Action.MessageSelectNPC");
                    actionType = Action.GIVE_TO;
                    break;
                }

                // If the list has elements, show the dialog with the options
                auxCreateInteractiveAction(message, actionType, validTypes, (selectedTarget) =>
                {
                    var action     = new Action(actionType, selectedTarget);
                    var parentItem = parent as ItemDataControl;
                    if (parentItem != null && controller.ShowStrictConfirmDialog("Remove element?", "Do you want the item to be removed or consumed in the action?"))
                    {
                        if (actionType == Action.DRAG_TO)
                        {
                            action.Effects.Add(new RemoveElementEffect(parentItem.getId()));
                        }
                        else
                        {
                            action.Effects.Add(new ConsumeObjectEffect(parentItem.getId()));
                        }
                    }
                    return(action);
                });
                break;
            }


            if (type == Controller.ACTION_CUSTOM_INTERACT)
            {
                controller.ShowInputDialog(TC.get("CustomAction.GetNameTitle"), TC.get("CustomAction.GetNameMessage"), (sender, name) =>
                {
                    if (string.IsNullOrEmpty(name))
                    {
                        name = "NONAME_" + Random.Range(0, 1000);
                    }

                    string[] options = { TC.get("Element.Action"), TC.get("Element.Interaction") };
                    controller.ShowInputDialog(TC.get("CustomAction.SelectTypeMessage"), TC.get("CustomAction.SelectTypeTitle"), options, (sender2, optionSelected) =>
                    {
                        switch (System.Array.IndexOf(options, optionSelected))
                        {
                        case 0:
                            {
                                var customAction = new CustomAction(Action.CUSTOM);
                                customAction.setName(name);
                                performAddAction(customAction);
                            }
                            break;

                        case 1:
                            auxCreateInteractiveAction(TC.get("CustomAction.MessageSelectInteraction"),
                                                       Action.CUSTOM_INTERACT, new System.Type[] { typeof(Item), typeof(ActiveArea), typeof(NPC) },
                                                       (selectedTarget) =>
                            {
                                var customAction = new CustomAction(Action.CUSTOM_INTERACT, selectedTarget);
                                customAction.setName(name);
                                return(customAction);
                            });
                            break;
                        }
                    });
                });
            }
            else if (type == Controller.ACTION_CUSTOM)
            {
                controller.ShowInputDialog(TC.get("CustomAction.GetNameTitle"), TC.get("CustomAction.GetNameMessage"), (sender, name) =>
                {
                    if (string.IsNullOrEmpty(name))
                    {
                        name = "NONAME_" + Random.Range(0, 1000);
                    }

                    var customAction = new CustomAction(Action.CUSTOM);
                    customAction.setName(name);
                    performAddAction(customAction);
                });
            }

            // If an action was added, create a controller and store it
            if (newAction != null)
            {
                performAddAction(newAction);
            }

            return(newAction != null);
        }
        public override void Draw(int aID)
        {
            workingItem = Target as ItemDataControl ?? Controller.Instance.SelectedChapterDataControl.getItemsList().getItems()[GameRources.GetInstance().selectedItemIndex];


            // -------------
            // Documentation
            // -------------

            GUILayout.Label(TC.get("Item.Documentation"));
            EditorGUI.BeginChangeCheck();
            var fullItemDescription = GUILayout.TextArea(workingItem.getDocumentation() ?? string.Empty);

            if (EditorGUI.EndChangeCheck())
            {
                workingItem.setDocumentation(fullItemDescription);
            }


            // -------------
            // Descriptions
            // -------------
            descriptionsEditor.Descriptions = workingItem.getDescriptionController();
            descriptionsEditor.OnInspectorGUI();
            GUILayout.Space(20);

            // -------------
            // Drag & drop
            // -------------

            EditorGUILayout.LabelField(TC.get("Item.ReturnsWhenDragged.Title"));
            EditorGUI.BeginChangeCheck();
            var dragdropToogle = EditorGUILayout.Toggle(dragdropLabel, workingItem.isReturnsWhenDragged());

            if (EditorGUI.EndChangeCheck())
            {
                workingItem.setReturnsWhenDragged(dragdropToogle);
            }
            GUILayout.Space(20);

            // -------------
            // Behaviour
            // -------------
            EditorGUI.BeginChangeCheck();
            var selectedBehaviourType = EditorGUILayout.Popup(TC.get("Behaviour"), (int)workingItem.getBehaviour(), behaviourTypes.Select(bt => TC.get(bt)).ToArray());

            Item.BehaviourType type = (selectedBehaviourType == 0 ? Item.BehaviourType.NORMAL : Item.BehaviourType.FIRST_ACTION);
            if (EditorGUI.EndChangeCheck())
            {
                workingItem.setBehaviour(type);
            }
            EditorGUILayout.HelpBox(TC.get(behaviourTypesDescription[selectedBehaviourType]), MessageType.Info);
            GUILayout.Space(20);

            // -------------
            // Transition time
            // -------------
            EditorGUI.BeginChangeCheck();
            var transitionTime = Math.Max(EditorGUILayout.LongField(transitionLabel, workingItem.getResourcesTransitionTime()), 0);

            if (EditorGUI.EndChangeCheck())
            {
                workingItem.setResourcesTransitionTime(transitionTime);
            }
        }
コード例 #36
0
        /**
         * Returns the info of the actions contained in the list.
         *
         * @return Array with the information of the actions. It contains the type
         *         of the action, and information about whether they have conditions
         *         and effects
         */
        public string[][] getActionsInfo()
        {
            string[][] actionsInfo = null;

            // Create the list for the actions
            actionsInfo = new string[actionsList.Count][];
            for (int i = 0; i < actionsList.Count; i++)
            {
                actionsInfo[i] = new string[3];
            }

            // Fill the array with the info
            for (int i = 0; i < actionsList.Count; i++)
            {
                Action action = actionsList[i];

                if (action.getType() == Action.EXAMINE)
                {
                    actionsInfo[i][0] = TC.get("ActionsList.ExamineAction");
                }
                else if (action.getType() == Action.GRAB)
                {
                    actionsInfo[i][0] = TC.get("ActionsList.GrabAction");
                }
                else if (action.getType() == Action.CUSTOM)
                {
                    actionsInfo[i][0] = TC.get("ActionsList.CustomAction", ((CustomAction)action).getName());
                }
                else if (action.getType() == Action.GIVE_TO)
                {
                    actionsInfo[i][0] = TC.get("ActionsList.GiveToAction", action.getTargetId());
                }
                else if (action.getType() == Action.USE_WITH)
                {
                    actionsInfo[i][0] = TC.get("ActionsList.UseWithAction", action.getTargetId());
                }
                else if (action.getType() == Action.CUSTOM_INTERACT)
                {
                    actionsInfo[i][0] = TC.get("ActionsList.CustomInteractAction", action.getTargetId());
                }
                else if (action.getType() == Action.USE)
                {
                    actionsInfo[i][0] = TC.get("ActionsList.UseAction");
                }
                else if (action.getType() == Action.TALK_TO)
                {
                    actionsInfo[i][0] = TC.get("ActionsList.TalkToAction");
                }
                else if (action.getType() == Action.DRAG_TO)
                {
                    actionsInfo[i][0] = TC.get("ActionsList.DragToAction");
                }

                if (action.getConditions().IsEmpty())
                {
                    actionsInfo[i][1] = TC.get("GeneralText.No");
                }
                else
                {
                    actionsInfo[i][1] = TC.get("GeneralText.Yes");
                }

                if (action.getEffects().IsEmpty())
                {
                    actionsInfo[i][2] = TC.get("GeneralText.No");
                }
                else
                {
                    actionsInfo[i][2] = TC.get("GeneralText.Yes");
                }
            }

            return(actionsInfo);
        }
コード例 #37
0
 protected PrimitiveIsObjectTypeQ(Primitive2 rator, Quotation rand0, SCode rand1)
     : base(rator, rand0, rand1)
 {
     this.rand0Value = (TC) (int) rand0.Quoted;
 }
コード例 #38
0
 protected virtual GUIContent OpenButtonText(T content, N node)
 {
     openButton.text = TC.get("GeneralText.Open");
     return(openButton);
 }
コード例 #39
0
        public override string renameElement(string name)
        {
            string oldSceneId = scene.getId();
            string references = controller.countIdentifierReferences(oldSceneId).ToString();

            // Ask for confirmation
            if (name != null || controller.ShowStrictConfirmDialog(TC.get("Operation.RenameSceneTitle"), TC.get("Operation.RenameElementWarning", new string[] { oldSceneId, references })))
            {
                // Show a dialog asking for the new scene id
                if (name == null)
                {
                    controller.ShowInputDialog(TC.get("Operation.RenameSceneTitle"), TC.get("Operation.RenameSceneMessage"), oldSceneId, (o, s) => performRenameElement <Scene>(s));
                }
                else
                {
                    return(performRenameElement <Scene>(name));
                }
            }

            return(null);
        }
コード例 #40
0
    public void ShowItemWindowView(int o)
    {
        isConcreteItemVisible = true;
        GameRources.GetInstance().selectedBookIndex = o;

        // Reload windows for newly selected book
        booksWindowAppearance    = new BooksWindowAppearance(thisRect, new GUIContent(TC.get("Book.App")), "Window");
        booksWindowContents      = new BooksWindowContents(thisRect, new GUIContent(TC.get("Book.Contents")), "Window");
        booksWindowDocumentation = new BooksWindowDocumentation(thisRect, new GUIContent(TC.get("Book.Documentation")), "Window");
    }
コード例 #41
0
        public static void CreateEffect(System.Action <IEffect> action)
        {
            var names = EffectEditorFactory.Intance.CurrentEffectEditors;

            if (names.Length > 0)
            {
                Controller.Instance.ShowInputDialog(TC.get("Effects.SelectEffectType"), TC.get("Effects.SelectEffectType"),
                                                    EffectEditorFactory.Intance.CurrentEffectEditors, (sender, selected) =>
                {
                    action(EffectEditorFactory.Intance.createEffectEditorFor(selected).Effect);
                    if (current != null)
                    {
                        current.Repaint();
                    }
                });
            }
            else
            {
                EditorUtility.DisplayDialog("Cant create", "No effects available!", "Ok");
            }
        }
コード例 #42
0
    public override void Draw(int aID)
    {
        // Show information of concrete item
        if (isConcreteItemVisible)
        {
            /**
             * UPPER MENU
             */
            GUILayout.BeginHorizontal();
            if (openedWindow == BookWindowType.Appearance)
            {
                GUI.skin = selectedButtonSkin;
            }
            if (GUILayout.Button(TC.get("Book.App")))
            {
                OnWindowTypeChanged(BookWindowType.Appearance);
            }
            if (openedWindow == BookWindowType.Appearance)
            {
                GUI.skin = defaultSkin;
            }

            if (openedWindow == BookWindowType.Documentation)
            {
                GUI.skin = selectedButtonSkin;
            }
            if (GUILayout.Button(TC.get("Book.Documentation")))
            {
                OnWindowTypeChanged(BookWindowType.Documentation);
            }
            if (openedWindow == BookWindowType.Documentation)
            {
                GUI.skin = defaultSkin;
            }

            if (openedWindow == BookWindowType.Content)
            {
                GUI.skin = selectedButtonSkin;
            }
            if (GUILayout.Button(TC.get("Book.Contents")))
            {
                OnWindowTypeChanged(BookWindowType.Content);
            }
            if (openedWindow == BookWindowType.Content)
            {
                GUI.skin = defaultSkin;
            }

            GUILayout.EndHorizontal();

            switch (openedWindow)
            {
            case BookWindowType.Appearance:
                booksWindowAppearance.Draw(aID);
                break;

            case BookWindowType.Documentation:
                booksWindowDocumentation.Draw(aID);
                break;

            case BookWindowType.Content:
                booksWindowContents.Draw(aID);
                break;
            }
        }
        else
        {
            GUILayout.Space(30);
            for (int i = 0; i < Controller.getInstance().getCharapterList().getSelectedChapterData().getBooks().Count; i++)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Box(Controller.getInstance().getCharapterList().getSelectedChapterData().getBooks()[i].getId(), GUILayout.Width(windowWidth * 0.75f));
                if (GUILayout.Button(TC.get("GeneralText.Edit"), GUILayout.MaxWidth(windowWidth * 0.2f)))
                {
                    ShowItemWindowView(i);
                }

                GUILayout.EndHorizontal();
            }
        }
    }
コード例 #43
0
 public override void recursiveSearch()
 {
     check(conversationLine.getName(), TC.get("Search.LineName"));
     check(conversationLine.getText(), TC.get("Search.LineText"));
 }
コード例 #44
0
        public static Dictionary <string, ConditionContextProperty> createContextFromOwner(int ownerType, string ownerName)
        {
            Dictionary <string, ConditionContextProperty> context1 = new Dictionary <string, ConditionContextProperty>();
            ConditionOwner owner = new ConditionOwner(ownerType, ownerName);

            context1.Add(ConditionsController.CONDITION_OWNER, owner);

            if (TC.containsConditionsContextText(ownerType, TC.NORMAL_SENTENCE) && TC.containsConditionsContextText(ownerType, TC.NO_CONDITION_SENTENCE))
            {
                ConditionCustomMessage cMessage = new ConditionCustomMessage(TC.getConditionsContextText(ownerType, TC.NORMAL_SENTENCE), TC.getConditionsContextText(ownerType, TC.NO_CONDITION_SENTENCE));
                context1.Add(CONDITION_CUSTOM_MESSAGE, cMessage);
            }

            return(context1);
        }
 public void draw()
 {
     EditorGUILayout.HelpBox(TC.get("Effect.CancelActionInfo"), MessageType.Info);
 }