Esempio n. 1
0
    public void ButtonClick()
    {
        switch (transform.name)
        {
        case "DeleteButton":
            Debug.Log("「削除する」を押した");
            // 削除ダイアログの表示
            canvasDialog.enabled = true;
            break;

        case "YesButton":
            Debug.Log("「はい」を押した");
            // DELETE処理
            ProcessingSQL deleteSQL = new ProcessingSQL();
            deleteSQL.DeleteSQL(CharacterList.CharacterName);

            // 削除ダイアログの消去
            canvasDialog.enabled = false;

            SceneManager.LoadScene("CharacterList");
            break;

        case "NoButton":
            Debug.Log("「いいえ」を押した");
            // 削除ダイアログの消去
            canvasDialog.enabled = false;
            break;

        default:
            break;
        }
    }
    // シーン開始後に呼び出される
    void Start()
    {
        Debug.Log("「キャラクター詳細画面」に遷移した");

        this.name = CharacterList.CharacterName;
        Debug.Log("name" + this.name);

        // キャラクターのデータを取得する
        ProcessingSQL countSQL  = new ProcessingSQL();
        DataTable     dataTable = countSQL.SelectSQL(this.name);

        //変数の準備
        var    name      = "";
        int    job       = 0;
        int    hp        = 0;
        int    mp        = 0;
        int    str       = 0;
        int    def       = 0;
        int    agi       = 0;
        int    luck      = 0;
        string create_at = null;

        // DBのデータを変数に格納
        foreach (DataRow dr in dataTable.Rows)
        {
            name      = (string)dr["name"];
            job       = (int)dr["job"];
            hp        = (int)dr["hp"];
            mp        = (int)dr["mp"];
            str       = (int)dr["str"];
            def       = (int)dr["def"];
            agi       = (int)dr["agi"];
            luck      = (int)dr["luck"];
            create_at = (string)dr["create_at"];
        }

        // 名前の表示用
        textName.text = name;

        //職業の表示用
        if (job == 0)
        {
            textJob.text = "戦士";
        }
        else if (job == 1)
        {
            textJob.text = "魔法使い";
        }
        else if (job == 2)
        {
            textJob.text = "僧侶";
        }
        else
        {
            textJob.text = "勇者";
        }

        textStatus.text = string.Format("\n{0}\n{1}\n{2}\n{3}\n{4}\n{5}", hp, mp, str, def, agi, luck);
    }
Esempio n. 3
0
    void Start()
    {
        Debug.Log("キャラクター一覧画面に遷移した");

        this.characterLimit = 10;

        // スクロールビューに表示するノードの数を調べる
        ProcessingSQL countSQL = new ProcessingSQL();
        int           count    = countSQL.CountSQL();

        Button btn = GameObject.Find("CreateButton").GetComponent <Button>();

        if (this.characterLimit <= count || 0 > count)
        {
            btn.interactable = false;
        }
        else
        {
            btn.interactable = true;
        }
    }
    public void ButtonClick()
    {
        switch (transform.name)
        {
        case "CreateButton":
            Debug.Log("「作成する」を押した");

            string name = "";

            //  入力されたテキストから名前を取得
            this.inputField = inputField.GetComponent <InputField>();
            name            = inputField.text;

            // 選択された職業の取得
            string selectedLabel = toggleGroup.ActiveToggles().First().GetComponentsInChildren <Text>()
                                   .First(t => t.name == "Label").text;
            Debug.Log(selectedLabel + "が選択された");

            // キャラクターの追加
            ProcessingSQL countSQL = new ProcessingSQL();
            countSQL.InsertSQL(name, selectedLabel);

            //
            CharacterList.CharacterName = name;
            Debug.Log(CharacterList.CharacterName);

            Debug.Log("キャラクター作成終了");
            // キャラクター作成完了画面に遷移
            SceneManager.LoadScene("CreateResult");
            break;

        case "BackButton":
            Debug.Log("「戻る」を押した");
            SceneManager.LoadScene("CharacterList");
            break;

        default:
            break;
        }
    }
    /// <summary>
    /// ボタンクリック時に呼び出される
    /// </summary>
    public void ButtonClick()
    {
        switch (transform.name)
        {
        case "NextCreateButton":
            Debug.Log("「続けて作成する」を押した");

            ProcessingSQL countSQL = new ProcessingSQL();
            int           count    = countSQL.CountSQL();
            if (count < this.characterLimit)
            {
                SceneManager.LoadScene("CharacterCreate");
            }
            else
            {
                // ダイアログ表示
                this.canvasDialog.enabled = true;
            }

            break;

        case "CreateEndButton":
            Debug.Log("「作成を終了する」を押した");
            SceneManager.LoadScene("CharacterList");
            break;

        case "BackButton":
            Debug.Log("「戻る」を押した");
            SceneManager.LoadScene("CharacterCreate");
            break;

        case "OKButton":
            this.canvasDialog.enabled = false;
            break;

        default:
            break;
        }
    }
Esempio n. 6
0
    // Start is called before the first frame update
    void Start()
    {
        // スクロールビューに表示するノードの数を調べる
        ProcessingSQL countSQL = new ProcessingSQL();
        int           count    = countSQL.CountSQL();

        // DB名を指定して接続
        SqliteDatabase sqlDB = new SqliteDatabase("namebattler.db");

        // 行数分のノードを作成する
        for (int i = 0; i < count; i++)
        {
            // ノードの自動作成
            var character = GameObject.Instantiate(prefab) as RectTransform;
            character.SetParent(transform, false);

            // ノード内に表示するテキストを検索する
            DataTable dataTable = countSQL.SelectSQL(i);

            string name      = "";
            int    job       = 0;
            int    hp        = 0;
            int    mp        = 0;
            int    str       = 0;
            int    def       = 0;
            int    agi       = 0;
            int    luck      = 0;
            string create_at = null;

            foreach (DataRow dr in dataTable.Rows)
            {
                name      = (string)dr["name"];
                job       = (int)dr["job"];
                hp        = (int)dr["hp"];
                mp        = (int)dr["mp"];
                str       = (int)dr["str"];
                def       = (int)dr["def"];
                agi       = (int)dr["agi"];
                luck      = (int)dr["luck"];
                create_at = (string)dr["create_at"];
            }


            texts         = character.GetComponentsInChildren <Text>();
            texts[0].text = name;

            if (job == 0)
            {
                texts[1].text = "戦士";
            }
            else if (job == 1)
            {
                texts[1].text = "魔法使い";
            }
            else if (job == 2)
            {
                texts[1].text = "僧侶";
            }
            else
            {
                texts[1].text = "勇者";
            }

            texts[2].text = $"HP: {hp} MP: {mp} STR: {str} DEF: {def} AGI: {agi}";
        }
    }