Ejemplo n.º 1
0
    void OnGUI()
    {
        e = Event.current;

        if (e.isKey && isChange)
        {
            string s = e.keyCode.ToString();
            switch (KeyName)
            {
            case "MoveF":
                MoveF.GetComponentInChildren <Text>().text = s;

                jt[0]["MoveF"] = s;
                break;

            case "MoveB":
                MoveB.GetComponentInChildren <Text>().text = s;

                jt[0]["MoveB"] = s;
                break;

            case "MoveU":
                MoveU.GetComponentInChildren <Text>().text = s;

                jt[0]["MoveU"] = s;
                break;

            case "MoveD":
                MoveD.GetComponentInChildren <Text>().text = s;

                jt[0]["MoveD"] = s;
                break;

            case "Jump":
                Jump.GetComponentInChildren <Text>().text = s;

                jt[0]["Jump"] = s;
                break;

            case "AtkKey":
                AtkKey.GetComponentInChildren <Text>().text = s;

                jt[0]["AtkKey"] = s;
                break;

            case "CheckKey":
                CheckKey.GetComponentInChildren <Text>().text = s;

                jt[0]["CheckKey"] = s;
                break;
            }
            jobj["PlayerSet"] = jt;
            string output = JsonConvert.SerializeObject(jobj, Formatting.Indented);
            File.WriteAllText(trl, output);
            ChangEnd();
            print(s);
        }
    }
Ejemplo n.º 2
0
 void TestStart()
 {
     MoveF.GetComponentInChildren <Text>().text    = jt[0]["MoveF"].ToString();
     MoveB.GetComponentInChildren <Text>().text    = jt[0]["MoveB"].ToString();
     MoveU.GetComponentInChildren <Text>().text    = jt[0]["MoveU"].ToString();
     MoveD.GetComponentInChildren <Text>().text    = jt[0]["MoveD"].ToString();
     Jump.GetComponentInChildren <Text>().text     = jt[0]["Jump"].ToString();
     AtkKey.GetComponentInChildren <Text>().text   = jt[0]["AtkKey"].ToString();
     CheckKey.GetComponentInChildren <Text>().text = jt[0]["CheckKey"].ToString();
 }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        param = SMParametre.Parametre.Load();
        param.Apply();

        UpButton       = Up.GetComponentInChildren <Button>();
        DownButton     = Down.GetComponentInChildren <Button>();
        RightButton    = Right.GetComponentInChildren <Button>();
        LeftButton     = Left.GetComponentInChildren <Button>();
        RunButton      = Run.GetComponentInChildren <Button>();
        JumpButton     = Jump.GetComponentInChildren <Button>();
        InteractButton = Interact.GetComponentInChildren <Button>();
        AttackButton   = Attack.GetComponentInChildren <Button>();

        UpText       = UpButton.gameObject.GetComponentInChildren <Text>();
        DownText     = DownButton.gameObject.GetComponentInChildren <Text>();
        LeftText     = LeftButton.gameObject.GetComponentInChildren <Text>();
        RightText    = RightButton.gameObject.GetComponentInChildren <Text>();
        RunText      = RunButton.gameObject.GetComponentInChildren <Text>();
        JumpText     = JumpButton.gameObject.GetComponentInChildren <Text>();
        AttackText   = AttackButton.gameObject.GetComponentInChildren <Text>();
        InteractText = InteractButton.gameObject.GetComponentInChildren <Text>();

        Sensi.value = param.Sensi;
        Sensi.onValueChanged.AddListener(Change);
        ShowKey();

        this.gameObject.GetComponent <Button>().onClick.AddListener(ResetCurrentKey);
        UpButton.onClick.AddListener(ClickButtonUp);
        DownButton.onClick.AddListener(ClickButtonDown);
        LeftButton.onClick.AddListener(ClickButtonLeft);
        RightButton.onClick.AddListener(ClickButtonRight);
        RunButton.onClick.AddListener(ClickButtonRun);
        JumpButton.onClick.AddListener(ClickButtonJump);
        InteractButton.onClick.AddListener(ClickButtonInteract);
        AttackButton.onClick.AddListener(ClickButtonAttack);
        ResetButton.onClick.AddListener(ClickButtonReset);
    }
Ejemplo n.º 4
0
    public void isCheck(string keyname)
    {
        KeyName = keyname;
        if (isChange)
        {
            print(KeyName);
            switch (KeyName)
            {
            case "MoveF":
                MoveB.GetComponentInChildren <Text>().text    = jt[0]["MoveB"].ToString();
                MoveU.GetComponentInChildren <Text>().text    = jt[0]["MoveU"].ToString();
                MoveD.GetComponentInChildren <Text>().text    = jt[0]["MoveD"].ToString();
                Jump.GetComponentInChildren <Text>().text     = jt[0]["Jump"].ToString();
                AtkKey.GetComponentInChildren <Text>().text   = jt[0]["AtkKey"].ToString();
                CheckKey.GetComponentInChildren <Text>().text = jt[0]["CheckKey"].ToString();
                break;

            case "MoveB":
                MoveF.GetComponentInChildren <Text>().text    = jt[0]["MoveF"].ToString();
                MoveU.GetComponentInChildren <Text>().text    = jt[0]["MoveU"].ToString();
                MoveD.GetComponentInChildren <Text>().text    = jt[0]["MoveD"].ToString();
                Jump.GetComponentInChildren <Text>().text     = jt[0]["Jump"].ToString();
                AtkKey.GetComponentInChildren <Text>().text   = jt[0]["AtkKey"].ToString();
                CheckKey.GetComponentInChildren <Text>().text = jt[0]["CheckKey"].ToString();
                break;

            case "MoveU":
                MoveB.GetComponentInChildren <Text>().text    = jt[0]["MoveB"].ToString();
                MoveD.GetComponentInChildren <Text>().text    = jt[0]["MoveD"].ToString();
                MoveF.GetComponentInChildren <Text>().text    = jt[0]["MoveF"].ToString();
                Jump.GetComponentInChildren <Text>().text     = jt[0]["Jump"].ToString();
                AtkKey.GetComponentInChildren <Text>().text   = jt[0]["AtkKey"].ToString();
                CheckKey.GetComponentInChildren <Text>().text = jt[0]["CheckKey"].ToString();
                break;

            case "MoveD":
                MoveB.GetComponentInChildren <Text>().text    = jt[0]["MoveB"].ToString();
                MoveU.GetComponentInChildren <Text>().text    = jt[0]["MoveU"].ToString();
                MoveF.GetComponentInChildren <Text>().text    = jt[0]["MoveF"].ToString();
                Jump.GetComponentInChildren <Text>().text     = jt[0]["Jump"].ToString();
                AtkKey.GetComponentInChildren <Text>().text   = jt[0]["AtkKey"].ToString();
                CheckKey.GetComponentInChildren <Text>().text = jt[0]["CheckKey"].ToString();
                break;

            case "Jump":
                MoveF.GetComponentInChildren <Text>().text    = jt[0]["MoveF"].ToString();
                MoveB.GetComponentInChildren <Text>().text    = jt[0]["MoveB"].ToString();
                MoveU.GetComponentInChildren <Text>().text    = jt[0]["MoveU"].ToString();
                MoveD.GetComponentInChildren <Text>().text    = jt[0]["MoveD"].ToString();
                AtkKey.GetComponentInChildren <Text>().text   = jt[0]["AtkKey"].ToString();
                CheckKey.GetComponentInChildren <Text>().text = jt[0]["CheckKey"].ToString();
                break;

            case "AtkKey":
                MoveF.GetComponentInChildren <Text>().text    = jt[0]["MoveF"].ToString();
                MoveB.GetComponentInChildren <Text>().text    = jt[0]["MoveB"].ToString();
                MoveU.GetComponentInChildren <Text>().text    = jt[0]["MoveU"].ToString();
                MoveD.GetComponentInChildren <Text>().text    = jt[0]["MoveD"].ToString();
                Jump.GetComponentInChildren <Text>().text     = jt[0]["Jump"].ToString();
                CheckKey.GetComponentInChildren <Text>().text = jt[0]["CheckKey"].ToString();
                break;

            case "CheckKey":
                MoveF.GetComponentInChildren <Text>().text  = jt[0]["MoveF"].ToString();
                MoveB.GetComponentInChildren <Text>().text  = jt[0]["MoveB"].ToString();
                MoveU.GetComponentInChildren <Text>().text  = jt[0]["MoveU"].ToString();
                MoveD.GetComponentInChildren <Text>().text  = jt[0]["MoveD"].ToString();
                Jump.GetComponentInChildren <Text>().text   = jt[0]["Jump"].ToString();
                AtkKey.GetComponentInChildren <Text>().text = jt[0]["AtkKey"].ToString();
                break;
            }
        }
        if (!isChange)
        {
            isChange = true;
        }
    }