示例#1
0
    private BoardCursorActualCore CreatePlayerCursor(bool isHuman, float offset, int player, BoardWar b1, BoardWar b2, bool force2P = false)
    {
        BoardCursorActualCore c;

        if (isHuman || force2P)
        {
            if (tutorialAssist != null)
            {
                c = GetTutorialCursor(player, offset, width, height, th);
            }
            else
            {
                c = GetUserCursor(player, offset, width, height, th, !force2P);
            }
            if (player == 1)
            {
                c.SetController(PD.controller, PD.GetKeyBindings());
            }
            else
            {
                c.SetController(PD.controller2, PD.GetKeyBindings(1));
            }
        }
        else
        {
            c = GetBotCursor(player, offset, width, height, th, b1, b2);
        }
        return(c);
    }
示例#2
0
    private InputCore GetInputHandler()
    {
        inputDelay = 0.0f;
        InputCore c = gameObject.AddComponent <InputCore>();

        c.SetController(PD.controller, PD.GetKeyBindings());
        return(c);
    }
示例#3
0
    protected OptionsCursor GetOptionsCursor(int w, int h, string sprite, float px, float py, float dx, float dy, int initX, int initY, int p = 1, int frame = -1, float dtweenchange = -1)
    {
        GameObject    g = Instantiate(gameObject, Vector3.zero, Quaternion.identity) as GameObject;
        OptionsCursor c = g.AddComponent <OptionsCursor>();

        Destroy(g);
        c.SetPD(PD);
        c.player = p;
        c.SetController(p == 1?PD.controller:PD.controller2, PD.GetKeyBindings(p - 1));
        c.setWidthAndHeight(w, h);
        c.Setup(th);
        c.SetupMenu(sprite, px, py, dx, dy, initX, initY, frame, dtweenchange);
        return(c);
    }
示例#4
0
    public void Setup()
    {
        top             = GetXMLHead();
        buttonsSheet    = Resources.LoadAll <Sprite>(SpritePaths.InputIcons);
        cancelSheet     = Resources.LoadAll <Sprite>(SpritePaths.CancelButtons);
        renderLayer     = "HUDText";
        headerText.text = GetXmlValue(top, "controls");
        float x = -0.25f;

        f       = PD.mostCommonFont.Clone();
        f.align = TextAlignment.Right; f.anchor = TextAnchor.MiddleRight;
        texts.Add(GetMeshText(new Vector2(x, 0.6f), "Up:", f));
        texts.Add(GetMeshText(new Vector2(x, 0.4f), "Down:", f));
        texts.Add(GetMeshText(new Vector2(x, 0.2f), "Left:", f));
        texts.Add(GetMeshText(new Vector2(x, 0.0f), "Right:", f));
        texts.Add(GetMeshText(new Vector2(x, -0.2f), "Launch/Confirm:", f));
        texts.Add(GetMeshText(new Vector2(x, -0.4f), "Shift Left:", f));
        texts.Add(GetMeshText(new Vector2(x, -0.6f), "Shift Right:", f));
        texts.Add(GetMeshText(new Vector2(x, -0.8f), "Shift All Left:", f));
        texts.Add(GetMeshText(new Vector2(x, -1.0f), "Shift All Right:", f));
        texts.Add(GetMeshText(new Vector2(x, -1.2f), "Pause:", f));
        texts.Add(GetMeshText(new Vector2(x, -1.4f), "Cancel:", f));
        f.align = TextAlignment.Left; f.anchor = TextAnchor.MiddleLeft;

        keyOrdering = new InputMethod.KeyBinding[] { InputMethod.KeyBinding.back, InputMethod.KeyBinding.pause, InputMethod.KeyBinding.shiftAR,
                                                     InputMethod.KeyBinding.shiftAL, InputMethod.KeyBinding.shiftR, InputMethod.KeyBinding.shiftL, InputMethod.KeyBinding.launch,
                                                     InputMethod.KeyBinding.right, InputMethod.KeyBinding.left, InputMethod.KeyBinding.down, InputMethod.KeyBinding.up };

        p1x = x + 0.75f;
        p1  = new List <GameObject>();
        texts.Add(GetMeshText(new Vector2(p1x, 1.0f), "P1", f));
        texts.Add(GetMeshText(new Vector2(p1x, 0.8f), "ALL", f));
        for (int y = 0; y < keyOrdering.Length; y++)
        {
            p1.Add(GetKeyBindingDisplay(PD.controller, new Vector2(p1x, -1.4f + y * 0.2f), keyOrdering[y]));
        }

        p2x = p1x + 1.75f;
        p2  = new List <GameObject>();
        texts.Add(GetMeshText(new Vector2(p2x, 1.0f), "P2", f));
        texts.Add(GetMeshText(new Vector2(p2x, 0.8f), "ALL", f));
        fakePlayer2 = new Input_Computer();
        fakePlayer2.Initialize(PD.GetKeyBindings(1));
        for (int y = 0; y < keyOrdering.Length; y++)
        {
            p2.Add(GetKeyBindingDisplay(fakePlayer2, new Vector2(p2x, -1.4f + y * 0.2f), keyOrdering[y]));
        }

        topCollider = GetCollider("top", new Vector3(1.45f, -0.2f), 1.2f, 13.5f);
    }
示例#5
0
    protected MenuCursor GetMenuCursor(int w, int h, string sprite, float px, float py, float dx, float dy, int initX, int initY, int p = 1, int frame = -1, float dtweenchange = -1, string sortLayer = "")
    {
        GameObject g = new GameObject("Menu CursorContainer " + p);
        MenuCursor c = g.AddComponent <MenuCursor>();

        c.SetPD(PD);
        c.player = p;
        c.SetController(p == 1?PD.controller:PD.controller2, PD.GetKeyBindings(p - 1));
        c.setWidthAndHeight(w, h);
        c.Setup(th);
        c.SetupMenu(sprite, px, py, dx, dy, initX, initY, frame, dtweenchange);
        if (sortLayer != "")
        {
            c.cursor.renderer.sortingLayerName = sortLayer;
        }
        return(c);
    }