예제 #1
0
        private EditInterface setupEditInterface(SlideAction editingAction, Slide slide)
        {
            currentAction = editingAction;
            EditInterface editInterface = editingAction.getEditInterface();

            editingAction.ChangesMade += editingAction_ChangesMade;
            editInterface.addCommand(new EditInterfaceCommand("Change Type", callback =>
            {
                callback.showBrowser <Func <String, SlideAction> >(actionTypeBrowser, delegate(Func <String, SlideAction> result, ref string errorPrompt)
                {
                    currentAction.ChangesMade -= editingAction_ChangesMade;
                    SlideAction newAction      = result(currentAction.Name);
                    newAction.ChangesMade     += editingAction_ChangesMade;
                    actionEditor.EditInterface = setupEditInterface(newAction, slide);
                    editingAction_ChangesMade(newAction);
                    errorPrompt = "";
                    return(true);
                });
            }));
            if (editingAction.AllowPreview)
            {
                editInterface.addCommand(new EditInterfaceCommand("Preview", callback =>
                {
                    previewTriggerAction.clear();
                    currentAction.setupAction(slide, previewTriggerAction);
                    if (PreviewTrigger != null)
                    {
                        PreviewTrigger.Invoke();
                    }
                }));
            }
            return(editInterface);
        }
예제 #2
0
    void Start()
    {
        gameObject.Play(SlideAction.Create(speed, isLocal));

        // Self-destroy
        Destroy(this);
    }
예제 #3
0
        void editingAction_ChangesMade(SlideAction obj)
        {
            String actionText = textEditor.Text;

            if (actionText == null)
            {
                actionText = "";
            }
            if (actionText.Length > 33)
            {
                actionText = actionText.Substring(0, 30) + "...";
            }

            undoBuffer.pushAndExecute(new TwoWayDelegateCommand <SlideAction, SlideAction>(CopySaver.Default.copy(currentAction), slide.getAction(currentAction.Name),
                                                                                           new TwoWayDelegateCommand <SlideAction, SlideAction> .Funcs()
            {
                ExecuteFunc = (exec) =>
                {
                    notificationManager.showNotification(String.Format("Changed trigger \"{0}\" action.", actionText), PreviewIconName, 3);
                    slide.replaceAction(exec);
                },
                UndoFunc = (undo) =>
                {
                    notificationManager.showNotification(String.Format("Undid trigger \"{0}\" action.", actionText), PreviewIconName, 3);
                    slide.replaceAction(undo);
                },
            }));
        }
        private RmlElementEditor openRangeEditor(Element element, GuiFrameworkUICallback uiCallback, int left, int top)
        {
            //Find actions
            String actionName = element.GetAttribute("onchange").StringValue;

            if (String.IsNullOrEmpty(actionName))
            {
                actionName = Guid.NewGuid().ToString();
                element.SetAttribute("onclick", actionName);
            }
            SlideAction action = slide.getAction(actionName);

            if (action == null)
            {
                action = new BlendSceneAction(actionName);
                slide.addAction(action);
            }

            //Make copy of action, this is really important, a lot of the function of this editor assumes this
            //is copied.
            SlideAction editingAction = CopySaver.Default.copy(action);

            EditInterface editInterface = setupEditInterface(editingAction, slide);

            editInterfaceEditor = new EditInterfaceEditor("Blend", editInterface, uiCallback);
            //appearanceEditor = new EditInterfaceEditor("Appearance", elementStyle.getEditInterface(), uiCallback);
            RmlElementEditor editor = RmlElementEditor.openEditor(element, left, top, this);

            editor.addElementEditor(editInterfaceEditor);
            return(editor);
        }
예제 #5
0
 public void replaceAction(SlideAction action)
 {
     if (hasAction(action.Name))
     {
         removeAction(action);
     }
     addAction(action);
 }
 private void EditingAction_ChangesMade(SlideAction obj)
 {
     undoBuffer.pushAndExecute(new TwoWayDelegateCommand <SlideAction, SlideAction>(CopySaver.Default.copy(currentAction), slide.getAction(currentAction.Name),
                                                                                    new TwoWayDelegateCommand <SlideAction, SlideAction> .Funcs()
     {
         ExecuteFunc = (exec) =>
         {
             notificationManager.showNotification("Changed slider action.", PreviewIconName, 3);
             slide.replaceAction(exec);
         },
         UndoFunc = (undo) =>
         {
             notificationManager.showNotification("Changed slider action.", PreviewIconName, 3);
             slide.replaceAction(undo);
         },
     }));
 }
예제 #7
0
        public override RmlElementEditor openEditor(Element element, GuiFrameworkUICallback uiCallback, int left, int top)
        {
            elementStyle          = new TextElementStyle(element, false);
            elementStyle.Changed += elementStyle_Changed;
            String rml = TextElementStrategy.DecodeFromHtml(element.InnerRml);

            textEditor = new ElementTextEditor(rml);
            String actionName = element.GetAttribute("onclick").StringValue;

            if (String.IsNullOrEmpty(actionName))
            {
                actionName = Guid.NewGuid().ToString();
                element.SetAttribute("onclick", actionName);
            }
            SlideAction action = slide.getAction(actionName);

            if (action == null)
            {
                action = ((Func <String, SlideAction>)actionTypeBrowser.DefaultSelection.Value)(actionName);
                slide.addAction(action);
            }

            //Make copy of action, this is really important, a lot of the function of this editor assumes this
            //is copied.
            SlideAction editingAction = CopySaver.Default.copy(action);

            EditInterface editInterface = setupEditInterface(editingAction, slide);

            actionEditor     = new EditInterfaceEditor("Action", editInterface, uiCallback);
            appearanceEditor = new EditInterfaceEditor("Appearance", elementStyle.getEditInterface(), uiCallback);
            RmlElementEditor editor = RmlElementEditor.openEditor(element, left, top, this);

            editor.addElementEditor(textEditor);
            editor.addElementEditor(actionEditor);
            editor.addElementEditor(appearanceEditor);
            return(editor);
        }
예제 #8
0
 public SlideSceneInfo(Slide slide, SceneThumbInfo sceneThumbInfo)
 {
     startupAction       = CopySaver.Default.copy(slide.StartupAction);
     this.sceneThumbInfo = sceneThumbInfo;
 }
예제 #9
0
 public static void doDone(SlideAction actionObject)
 {
     SceneViews.instance.getCurFBScene().getActor(actionObject.objectID).setAnimatorTrigger("slide");
 }
예제 #10
0
        private void OnFloorUpdate()
        {
            this.status.coyoteJump = Systems.timer.Frame + 4;

            // Character Movement & Handling
            FInt speedMult = (this.shoes is Shoes || this.input.isDown(IKey.XButton)) ? FInt.Create(1) : this.stats.SlowSpeedMult;
            FInt maxSpeed  = this.stats.RunMaxSpeed * speedMult;

            // Movement Right
            if (this.input.isDown(IKey.Right))
            {
                this.FaceRight = true;

                // Move Right up to maximum speed. (Must use FInt Math, not Math.Min)
                if (maxSpeed > this.physics.velocity.X)
                {
                    this.physics.velocity.X += this.stats.RunAcceleration * speedMult;
                    if (this.physics.velocity.X > maxSpeed)
                    {
                        this.physics.velocity.X = maxSpeed;
                    }
                }

                // If there's too much momentum, decelerate to normal speed:
                else
                {
                    this.DecelerateChar(this.stats.RunDeceleration, 2 - speedMult, FInt.Create(0.25));
                }
            }

            // Movement Left
            else if (this.input.isDown(IKey.Left))
            {
                this.FaceRight = false;

                // Move Left up to maximum speed. (Must use FInt Math, not Math.Min)
                if (this.physics.velocity.X > maxSpeed.Inverse)
                {
                    this.physics.velocity.X -= this.stats.RunAcceleration * speedMult;
                    if (this.physics.velocity.X < maxSpeed.Inverse)
                    {
                        this.physics.velocity.X = maxSpeed.Inverse;
                    }
                }

                // If there's too much momentum, decelerate to normal speed:
                else
                {
                    this.DecelerateChar(this.stats.RunDeceleration, 2 - speedMult, FInt.Create(0.25));
                }
            }

            // Resting Friction (No Intentional Movement)
            else
            {
                this.DecelerateChar(this.stats.RunDeceleration, 2 - speedMult, FInt.Create(2));
            }

            // As long as we're not currently sliding:
            if (status.action is SlideAction == false)
            {
                // Reset Actions on Land
                if (this.physics.touch.toBottom)
                {
                    // Only apply landing if the minimum jump time has not passed.
                    // Prevents issues like springs causing infinite jumps.
                    if (status.action is JumpAction == false || JumpAction.MinimumTimePassed(status))
                    {
                        if (status.action is Action)
                        {
                            status.action.LandsOnGround(this);
                        }
                        status.jumpsUsed = 0;
                    }

                    // Update Shoes
                    if (this.shoes is Shoes)
                    {
                        this.shoes.TouchWall();
                    }
                }

                // Attempt Jump
                bool doJump = status.action is JumpAction == false && (input.isPressed(IKey.AButton) || (input.isDown(IKey.AButton) && status.rapidRejump >= Systems.timer.Frame));

                // JUMP Button Pressed
                if (doJump)
                {
                    // JUMP+DOWN (Slide or Platform Drop) is Activated
                    if (input.isDown(IKey.Down))
                    {
                        // If on a Platform, perform Down-Jump
                        if (this.physics.touch.onMover)
                        {
                            ActionMap.Dropdown.StartAction(this, 6);
                        }

                        // Slide, if able:
                        else if (SlideAction.IsAbleToSlide(this, this.FaceRight))
                        {
                            ActionMap.Slide.StartAction(this, this.FaceRight);
                        }

                        // Otherwise, JUMP.
                        else
                        {
                            ActionMap.Jump.StartAction(this);
                        }
                    }

                    // JUMP
                    else
                    {
                        ActionMap.Jump.StartAction(this);
                    }
                }
            }
        }
예제 #11
0
 // Use this for initialization
 void Start()
 {
     slideAction = gameObject.GetComponent<SlideAction> ();
             GameObject gmHold = GameObject.Find ("GameManager");
             physMan = gmHold.GetComponent<PhysicsManipulation> ();
 }
예제 #12
0
 public void removeAction(SlideAction action)
 {
     triggerActions.Remove(action.Name);
 }
예제 #13
0
 public void addAction(SlideAction action)
 {
     triggerActions.Add(action.Name, action);
 }