Ejemplo n.º 1
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.A))
     {
         ShowControls sc = ShowControls.CreateDocked(new ControlItem("An example of showing controls for a single key", KeyCode.Space));
         sc.destroyWhenDone = true;
         sc.Show();
     }
     if (Input.GetKeyDown(KeyCode.S))
     {
         ShowControls sc = ShowControls.CreateDocked(new ControlItem("An example of showing a mouse click", MouseButton.LeftClick));
         sc.destroyWhenDone = true;
         sc.Show();
     }
     if (Input.GetKeyDown(KeyCode.D))
     {
         ShowControls sc = ShowControls.CreateDocked(new ControlItem("An example of showing click & drag", MouseDirection.Both, MouseButton.RightClick));
         sc.destroyWhenDone = true;
         sc.Show();
     }
     if (Input.GetKeyDown(KeyCode.F))
     {
         ShowControls sc = ShowControls.CreateDocked(new[] {
             new ControlItem("An example of a mouse click with a modifier key", KeyCode.LeftControl, MouseButton.LeftClick),
             new ControlItem("Also an example of showing multiple keys AND mouse button AND direction, and showing multiple controls at once", new[] { KeyCode.LeftShift, KeyCode.LeftControl }, MouseDirection.Horizontal, MouseButton.RightClick)
         });
         sc.destroyWhenDone = true;
         sc.Show();
     }
 }
Ejemplo n.º 2
0
    void AddPowerup(string powerup)
    {
        // create a new docked ShowControls, and also add the control
        // to the fullscreen list.
        switch (powerup)
        {
        case "Jump":
            hasJump = true;
            fullscreen.controls.Add(new ControlItem(jumpFull, KeyCode.Space));

            /* create the "jump" dock.  We don't need to keep track of the
             * ShowControls it returns, as it will take care of itself
             * when the duration runs out.  Create it, & immediately show it. */
            ShowControls.CreateDocked(new ControlItem(jumpPopup, KeyCode.Space)).Show();
            break;

        case "Die":
            hasDie = true;
            fullscreen.controls.Add(new ControlItem(dieFull, MouseButton.LeftClick));

            /* Create the "die" dock.  We don't show it immediately because
             * we want to adjust the duration before showing. */
            dieDock = ShowControls.CreateDocked(new ControlItem(diePopup, MouseButton.LeftClick));
            dieDock.showDuration = -1;
            dieDock.Show();
            break;
        }
    }
Ejemplo n.º 3
0
 void AddPowerup(string powerup)
 {
     // create a new docked ShowControls, and also add the control
     // to the fullscreen list.
     switch (powerup) {
         case "Jump":
             hasJump = true;
             fullscreen.controls.Add(
                 new ControlItem(jumpFull, KeyCode.Space));
             // create the "jump" dock.  We don't need to keep track of the
             // ShowControls it returns, as it will take care of itself
             // when the duration runs out.  Create it, & immediately
             // show it.
             ShowControls.CreateDocked(
                 new ControlItem(jumpPopup, KeyCode.Space)).Show();
             break;
         case "Die":
             hasDie = true;
             fullscreen.controls.Add(
                 new ControlItem(dieFull, MouseButton.LeftClick));
             // Create the "die" dock.  We don't show it immediately
             // because we want to adjust the duration before showing.
             dieDock = ShowControls.CreateDocked(
                 new ControlItem(diePopup, MouseButton.LeftClick));
             dieDock.showDuration = -1;
             dieDock.Show();
             break;
     }
 }
Ejemplo n.º 4
0
 public void Start()
 {
     layerPlayer = LayerMask.NameToLayer("Player");
     switch(name) {
         case "scMovement":
             sc = ShowControls.CreateDocked(new ControlItem[] {
                 new ControlItem("Use Left and Right to Move",
                     new KeyCode[] { KeyCode.LeftArrow, KeyCode.RightArrow }),
                 new ControlItem("Use Space to Jump", KeyCode.Space)
             });
             mainMsg = "Activate all the waypoints to your world!";
             break;
         case "scCharge":
             sc = ShowControls.CreateDocked(
                 new ControlItem("Hold down to charge beacons to your world.",
                     KeyCode.DownArrow));
             mainMsg = "Once charged, beacons heal you.\nBut they need recharged after a time.";
             break;
         case "scWaypoint":
             sc = ShowControls.CreateDocked(
                 new ControlItem("Hold down to charge waypoints.",
                     KeyCode.DownArrow));
             mainMsg = "Waypoints take longer to charge,\n but stay permanently activated.";
             break;
     }
     sc.showDuration = Mathf.Infinity;
 }
Ejemplo n.º 5
0
 public void UpdateWorld(GameWorld world)
 {
     if (sc != null) {
         Destroy(sc);
     }
     string moveDesc="Move yourself around", switchDesc="Change yourself", attackDesc = null;
     switch (world) {
         case GameWorld.dino:
             attackDesc = "Attack!";
             break;
         case GameWorld.space:
             attackDesc = "Fly up";
             break;
         case GameWorld.race:
             attackDesc = "Speed Boost";
             break;
     }
     if (attackDesc != null) {
         sc = ShowControls.CreateDocked(new ControlItem[] {
             new ControlItem(moveDesc, CustomDisplay.arrows),
             new ControlItem(switchDesc, KeyCode.LeftControl),
             new ControlItem(attackDesc, KeyCode.Space)
         });
     } else {
         sc = ShowControls.CreateDocked(new ControlItem[] {
             new ControlItem(moveDesc, CustomDisplay.arrows),
             new ControlItem(switchDesc, KeyCode.LeftControl)
         });
     }
     sc.size = ShowControlSize.Small;
     sc.position = ShowControlPosition.Bottom;
     sc.slideSpeed = 0;
     sc.showDuration = -1;
     sc.Show();
 }
Ejemplo n.º 6
0
    /// <summary>
    /// Creates a new ShowControls for a multiple controls that will be docked.
    /// </summary>
    public static ShowControls CreateDocked(ControlItem[] controls)
    {
        GameObject   prefab = (GameObject)Resources.Load("DefaultShowControls");
        GameObject   obj    = (GameObject)Instantiate(prefab);
        ShowControls sc     = obj.GetComponent <ShowControls>();

        sc.controls = new ArrayList(controls);
        return(sc);
    }
Ejemplo n.º 7
0
    /// <summary>
    /// Creates a new ShowControls for a multiple controls that will shown fullscreen.
    /// </summary>
    public static ShowControls CreateFullscreen(ControlItem[] controls)
    {
        GameObject   prefab = (GameObject)Resources.Load("DefaultShowControls");
        GameObject   obj    = (GameObject)Instantiate(prefab);
        ShowControls sc     = obj.GetComponent <ShowControls>();

        sc.controls       = new ArrayList(controls);
        sc.style          = ShowControlStyle.FullScreen;
        sc.slideSpeed     = -1;
        sc.showDuration   = -1;
        sc.pauseOnDisplay = true;
        return(sc);
    }
Ejemplo n.º 8
0
    /// <summary>
    /// Creates a script block which loads a QuickTime video at runtime.
    /// </summary>
    /// <returns>Script block that will load a QuickTime video</returns>
    private string BuildScriptBlock()
    {
        string scriptBlock = string.Format("LoadQuickTime('QTPlaceholder_{0}', '{1}', {2}, {3}, '{4}', '{5}', '{6}', {7});",
                                           ltlScript.ClientID,
                                           HTMLHelper.HTMLEncode(URLHelper.ResolveUrl(VideoURL)),
                                           Width,
                                           Height,
                                           ShowControls.ToString().ToLowerCSafe(),
                                           Autostart.ToString().ToLowerCSafe(),
                                           Loop.ToString().ToLowerCSafe(),
                                           ScriptHelper.GetString(GetString("Media.NotSupported")));

        return(ScriptHelper.GetScript(scriptBlock));
    }
Ejemplo n.º 9
0
    void Start()
    {
        /* fsBlender is the fullscreen blender controls, which we show with Tab */
        fsBlender = ShowControls.CreateFullscreen(new[] {
            new ControlItem(descOrbit, MouseDirection.Both, MouseButton.MiddleClick),
            new ControlItem(descPan, KeyCode.LeftShift, MouseDirection.Both, MouseButton.MiddleClick),
            new ControlItem(descZoom, MouseButton.ScrollWheel),
            new ControlItem(descFocus, KeyCode.KeypadPeriod),
            new ControlItem(descPlay, new[] { KeyCode.LeftAlt, KeyCode.A }),
            new ControlItem(descFs, new[] { KeyCode.LeftShift, KeyCode.Space })
        });
        fsBlender.fullscreenTitle    = "Handy Blender Controls";
        fsBlender.fullscreenClearKey = blenderKey;

        /* fsUnity is the fullscreen unity controls, which we show with Z */
        fsUnity = ShowControls.CreateFullscreen(new[] {
            new ControlItem(descOrbit, KeyCode.LeftAlt, MouseDirection.Both, MouseButton.LeftClick),
            new ControlItem(descPan, KeyCode.LeftAlt, MouseDirection.Both, MouseButton.MiddleClick),
            new ControlItem(descZoom, KeyCode.LeftAlt, MouseDirection.Horizontal, MouseButton.RightClick),
            new ControlItem(descFocus, KeyCode.F),
            new ControlItem(descPlay, new[] { KeyCode.LeftControl, KeyCode.P }),
            new ControlItem(descFs, KeyCode.Space)
        });
        fsUnity.fullscreenTitle    = "Common controls for Unity";
        fsUnity.fullscreenClearKey = unityKey;

        /* fsTop is the top docked controls that always display, unless either
         * fullscreen display is showing. */
        fsTop = ShowControls.CreateDocked(new[] {
            new ControlItem("Show Blender controls", fsBlender.fullscreenClearKey),
            new ControlItem("Show Unity controls", fsUnity.fullscreenClearKey),
            new ControlItem("Create indefinite bottom dock", bottomPermKey),
            new ControlItem("Create temporary bottom dock", bottomTempKey)
        });
        fsTop.showDuration = -1;
        fsTop.size         = ShowControlSize.Small;
        fsTop.slideSpeed   = -1;
        fsTop.Show();

        /* the bottom controls are created now, but aren't displayed until
         * we press the proper key */
        bottomPerm = ShowControls.CreateDocked(new[] {
            new ControlItem(descBottomPerm, bottomPermKey)
        });
        bottomPerm.position = ShowControlPosition.Bottom;
        bottomPerm.hideLeftRightOnModifierKeys = false;
        bottomPerm.showDuration = -1;
    }
Ejemplo n.º 10
0
    void Start ()
    {
        /* fsBlender is the fullscreen blender controls, which we show with Tab */
        fsBlender = ShowControls.CreateFullscreen(new[] {
            new ControlItem(descOrbit, MouseDirection.Both, MouseButton.MiddleClick),
            new ControlItem(descPan, KeyCode.LeftShift, MouseDirection.Both, MouseButton.MiddleClick),
            new ControlItem(descZoom, MouseButton.ScrollWheel),
            new ControlItem(descFocus, KeyCode.KeypadPeriod),
            new ControlItem(descPlay, new[] { KeyCode.LeftAlt, KeyCode.A }),
            new ControlItem(descFs, new[] { KeyCode.LeftShift, KeyCode.Space })
        });
        fsBlender.fullscreenTitle = "Handy Blender Controls";
        fsBlender.fullscreenClearKey = blenderKey;

        /* fsUnity is the fullscreen unity controls, which we show with Z */
        fsUnity = ShowControls.CreateFullscreen(new[] {
            new ControlItem(descOrbit, KeyCode.LeftAlt, MouseDirection.Both, MouseButton.LeftClick),
            new ControlItem(descPan, KeyCode.LeftAlt, MouseDirection.Both, MouseButton.MiddleClick),
            new ControlItem(descZoom, KeyCode.LeftAlt, MouseDirection.Horizontal, MouseButton.RightClick),
            new ControlItem(descFocus, KeyCode.F),
            new ControlItem(descPlay, new[] { KeyCode.LeftControl, KeyCode.P }),
            new ControlItem(descFs, KeyCode.Space)
        });
        fsUnity.fullscreenTitle = "Common controls for Unity";
        fsUnity.fullscreenClearKey = unityKey;

        /* fsTop is the top docked controls that always display, unless either
         * fullscreen display is showing. */
        fsTop = ShowControls.CreateDocked(new[] {
            new ControlItem("Show Blender controls", fsBlender.fullscreenClearKey),
            new ControlItem("Show Unity controls", fsUnity.fullscreenClearKey),
            new ControlItem("Create indefinite bottom dock", bottomPermKey),
            new ControlItem("Create temporary bottom dock", bottomTempKey)
        });
        fsTop.showDuration = -1;
        fsTop.size = ShowControlSize.Small;
        fsTop.slideSpeed = -1;
        fsTop.Show();

        /* the bottom controls are created now, but aren't displayed until
         * we press the proper key */
        bottomPerm = ShowControls.CreateDocked(new[] {
            new ControlItem(descBottomPerm, bottomPermKey)
        });
        bottomPerm.position = ShowControlPosition.Bottom;
        bottomPerm.hideLeftRightOnModifierKeys = false;
        bottomPerm.showDuration = -1;
	}
Ejemplo n.º 11
0
 public void Start()
 {
     birdTargets = FindObjectsOfType <BirdTarget>();
     uiTime.text = timeTotal.ToString(".0");
     // web player doesn't need the exit button
     if (Application.platform == RuntimePlatform.WebGLPlayer)
     {
         GameObject.Destroy(exitButton);
     }
     controls = ShowControls.CreateDocked(new ControlItem[] {
         new ControlItem("Use arrow keys to walk left and right",
                         new KeyCode[] { KeyCode.LeftArrow, KeyCode.RightArrow }),
         new ControlItem("Press space to jump", KeyCode.Space)
     });
     controls.position     = ShowControlPosition.Bottom;
     controls.showDuration = -1;
     controls.Show();
 }
Ejemplo n.º 12
0
    void InitShowControls()
    {
        scCancel = ShowControls.CreateDocked(new ControlItem("Skip Tutorial", KeyCode.Escape));
        scCancel.position = ShowControlPosition.Bottom;
        scCancel.showDuration = -1;
        scCancel.size = ShowControlSize.Small;
        scCancel.Show();

        scAttack = ShowControls.CreateDocked(new ControlItem[] {
            new ControlItem("Move Penthos around", CustomDisplay.arrows),
            new ControlItem("Attack the draglins!", KeyCode.LeftControl)
        });
        scAttack.showDuration = -1;

        scToggle1 = ShowControls.CreateDocked(new ControlItem("Hold to open a rift, cleansing the corruption from this location and all nearby locations.", KeyCode.Space));
        scToggle1.showDuration = -1;

        scToggle2 = ShowControls.CreateDocked(new ControlItem("Beware, any clear location will also become corrupted.  Fully cleanse each level to continue.", KeyCode.Space));
        scToggle2.showDuration = -1;
    }
Ejemplo n.º 13
0
    void Update()
    {
        if (Input.GetKeyDown(fsBlender.fullscreenClearKey))
        {
            fsUnity.Hide();
            fsBlender.Toggle();
        }
        if (Input.GetKeyDown(fsUnity.fullscreenClearKey))
        {
            fsBlender.Hide();
            fsUnity.Toggle();
        }
        if (!fsBlender.IsShown && !fsUnity.IsShown)
        {
            fsTop.Show();

            /* if we're pressing the key for the temp ShowControls and
             * it doesn't already exist, instantiate it.  When it's done,
             * it'll automatically Destroy itself and we'll be able to
             * make it again. */
            if (Input.GetKeyDown(bottomTempKey) && bottomTmp == null)
            {
                bottomTmp = ShowControls.CreateDocked(new[] {
                    new ControlItem(descBottomTemp, bottomTempKey)
                });
                bottomTmp.offsetX         = Screen.width / 2;
                bottomTmp.showDuration    = 5;
                bottomTmp.position        = ShowControlPosition.Bottom;
                bottomTmp.destroyWhenDone = true;
                bottomTmp.Show();
            }
            if (Input.GetKeyDown(bottomPermKey))
            {
                bottomPerm.Toggle();
            }
        }
        else
        {
            fsTop.Hide();
        }
    }
Ejemplo n.º 14
0
    // Use this for initialization
    void Start()
    {
        stages.Add("Start", 1);
        stages.Add("doStage2", 2);
        stages.Add("doStage3", 3);
        stages.Add("doStage4", 4);

        scStart = ShowControls.CreateDocked(
            new ControlItem("Welcome to Muffin the Destroyer!\n\nUse left and right to move Muffins.  Walk right to continue",
                new[] { KeyCode.LeftArrow, KeyCode.RightArrow }));
        sc2 = ShowControls.CreateDocked(
            new ControlItem("Use Z to jump, press Z again in mid-air to stomp!",
                KeyCode.Z));
        sc3 = ShowControls.CreateDocked(
            new ControlItem("Press X to swipe in front of you.",
                KeyCode.X));

        scStart.showDuration = -1;
        sc2.showDuration = -1;
        sc3.showDuration = -1;

        scStart.Show();
    }
Ejemplo n.º 15
0
	void Start ()
    {
        startPoint = transform.position;
        cc = GetComponent<CharacterController>();

        /* Create the fullscreen ShowControls with a control,
         * but don't show it yet. */
        fullscreen = ShowControls.CreateFullscreen(new ControlItem(moveFull, CustomDisplay.wasd));
        fullscreen.fullscreenMessageLeft = "Mash ";
        fullscreen.fullscreenClearKey = KeyCode.Tab;
        fullscreen.fullscreenMessageRight = "to keep rockin'";

        // make a ShowControls at the bottom to show movement &
        // the controls screen.  It stays around forever.
        bottomDock = ShowControls.CreateDocked(new[] {
            new ControlItem(movePopup, CustomDisplay.wasd),
            new ControlItem(menuPopup, KeyCode.Tab)});
        bottomDock.size = ShowControlSize.Small;
        bottomDock.showDuration = -1;
        bottomDock.slideSpeed = -1;
        bottomDock.position = ShowControlPosition.Bottom;
        bottomDock.Show();
	}
Ejemplo n.º 16
0
    void Start()
    {
        startPoint = transform.position;
        cc         = GetComponent <CharacterController>();

        /* Create the fullscreen ShowControls with a control,
         * but don't show it yet. */
        fullscreen = ShowControls.CreateFullscreen(new ControlItem(moveFull, CustomDisplay.wasd));
        fullscreen.fullscreenMessageLeft  = "Mash ";
        fullscreen.fullscreenClearKey     = KeyCode.Tab;
        fullscreen.fullscreenMessageRight = "to keep rockin'";

        // make a ShowControls at the bottom to show movement &
        // the controls screen.  It stays around forever.
        bottomDock = ShowControls.CreateDocked(new[] {
            new ControlItem(movePopup, CustomDisplay.wasd),
            new ControlItem(menuPopup, KeyCode.Tab)
        });
        bottomDock.size         = ShowControlSize.Small;
        bottomDock.showDuration = -1;
        bottomDock.slideSpeed   = -1;
        bottomDock.position     = ShowControlPosition.Bottom;
        bottomDock.Show();
    }
Ejemplo n.º 17
0
 public void Start()
 {
     CuteMusicPlayer.Instance.PlayMusic("stageMusic");
     string moveDesc = "Use the arrow keys to move the player around.";
     string attackDesc = "Hold the spacebar to aim an Super Headbutt.  Hold a direction to headbutt, and release the spacebar to let it fly!";
     if(showControls) {
         sc = ShowControls.CreateDocked(new ControlItem[] {
             new ControlItem(moveDesc, CustomDisplay.arrows),
             new ControlItem(attackDesc, KeyCode.Space)
         });
         sc.slideSpeed = -1;
         sc.showDuration = -1;
         sc.Show();
     }
 }
Ejemplo n.º 18
0
 public void Start()
 {
     birdTargets = FindObjectsOfType<BirdTarget>();
     uiTime.text = timeTotal.ToString(".0");
     // web player doesn't need the exit button
     if (Application.platform == RuntimePlatform.WebGLPlayer) {
             GameObject.Destroy(exitButton);
     }
     controls = ShowControls.CreateDocked(new ControlItem[] {
         new ControlItem("Use arrow keys to walk left and right",
             new KeyCode[] { KeyCode.LeftArrow, KeyCode.RightArrow }),
         new ControlItem("Press space to jump", KeyCode.Space)
     });
     controls.position = ShowControlPosition.Bottom;
     controls.showDuration = -1;
     controls.Show();
 }