Ejemplo n.º 1
0
 public Card(RANK rank, SUIT suit,bool faceUp)
 {
     this.rank = (int)rank;
     this.suit = (int)suit;
     this.faceUp = faceUp;
     highlight = false;
 }
Ejemplo n.º 2
0
 public Card(RANK rank, SUIT suit)
 {
     this.rank = (int)rank;
     this.suit = (int)suit;
     faceUp    = false;
     highlight = false;
 }
Ejemplo n.º 3
0
        public async Task <ActionResult> Create([Bind(Include = "ID,TEN,HINHANH")] RANK rank, HttpPostedFileBase HINHANH)
        {
            if (ModelState.IsValid)
            {
                if (HINHANH != null)
                {
                    List <string> lstFilePath = new List <string>();

                    // Some browsers send file names with full path. This needs to be stripped.
                    var fileName = Path.GetFileName(HINHANH.FileName);
                    fileName = Guid.NewGuid().ToString() + HINHANH.FileName;
                    var physicalPath = Path.Combine(Server.MapPath("~/Upload"), fileName);

                    // The files are not actually saved in this demo
                    HINHANH.SaveAs(physicalPath);
                    lstFilePath.Add("~/Upload/" + fileName);
                    if (lstFilePath.Count > 0)
                    {
                        rank.HINHANH = string.Join(";", lstFilePath);
                    }
                }
                rank.ID = Guid.NewGuid().ToString();
                db.RANKs.Add(rank);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(rank));
        }
Ejemplo n.º 4
0
        public string RankString(RANK rank)
        {
            switch (rank)
            {
            default: return("");

            case RANK._2: return("2");

            case RANK._3: return("3");

            case RANK._4: return("4");

            case RANK._5: return("5");

            case RANK._6: return("6");

            case RANK._7: return("7");

            case RANK._8: return("8");

            case RANK._9: return("9");

            case RANK._T: return("T");

            case RANK._J: return("J");

            case RANK._Q: return("Q");

            case RANK._K: return("K");

            case RANK._A: return("A");
            }
        }
Ejemplo n.º 5
0
        public List <UserInfo> GetFriend(string name)
        {
            List <UserInfo> result;

            try
            {
                string cmdStr = string.Format("select friendNick, score, rank from user, friend where friend.userNick=user.nick and friend.userNick=\"{0}\";", name);
                cmd    = new OdbcCommand(cmdStr, conn);
                reader = cmd.ExecuteReader();

                result = new List <UserInfo>();
                int index = 0;
                while (reader.Read())
                {
                    string nick  = reader.GetString(0);
                    int    score = reader.GetInt32(1);
                    RANK   rank  = (RANK)reader.GetInt32(2);
                    result.Add(new UserInfo(index++, nick, score, rank));
                }

                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            return(null);
        }
Ejemplo n.º 6
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    public override void OnDBPull(HTTPReq req)
    {
        JSon json = new JSon(req.response);

        if (json["error"] != null)
        {
            return;
        }

        if ((json.root is JSonObject) == false)
        {
            return;
        }


        JSonObject o = json.root as JSonObject;

        m_loginUsername = o["login_username"].value;

        m_loginPassword = o["login_password"].value;

        name = o["name"].value;

        m_rank = ( RANK )System.Enum.Parse(typeof(RANK), o["rank"].value, true);

        m_type = ( TYPE )System.Enum.Parse(typeof(TYPE), o["type"].value, true);
    }
Ejemplo n.º 7
0
 public UserInfo(int index, string name, int score, RANK rank)
 {
     Index = index;
     Name  = name;
     Score = score;
     Rank  = rank;
 }
Ejemplo n.º 8
0
 public Card(RANK rank, SUIT suit, bool faceUp)
 {
     this.rank   = (int)rank;
     this.suit   = (int)suit;
     this.faceUp = faceUp;
     highlight   = false;
 }
Ejemplo n.º 9
0
    void NotesProcess()
    {
        //タイミングのランクを登録する
        if (notesLeftPos <= 50f && notesLeftPos >= -30f)
        {
            Debug.Log("Excellent!!");
            rankJudge = RANK.Excellent;
        }
        if (notesLeftPos < -30f && notesLeftPos >= -60f)
        {
            Debug.Log("Good!!");
            rankJudge = RANK.Good;
        }
        if (notesLeftPos < -60f && notesLeftPos >= -150f)
        {
            Debug.Log("Bad!!");
            rankJudge = RANK.Bad;
        }

        MainGame_SE mainGame_SE = seObj.GetComponent <MainGame_SE>();

        mainGame_SE.StepSound();//足音

        BeatUi.notesLefts.RemoveAt(0);
        Destroy(obj);
    }
Ejemplo n.º 10
0
 public Card(RANK rank,SUIT suit)
 {
     this.rank = (int)rank;
     this.suit = (int)suit;
     faceUp = false;
     highlight = false;
 }
Ejemplo n.º 11
0
        private Card FromString(string cardStr)
        {
            RANK rank = (RANK)Enum.Parse(typeof(RANK), "R" + cardStr.Split('_')[1]);
            SUIT suit = (SUIT)Enum.Parse(typeof(SUIT), cardStr.Split('_')[0]);

            return(new Card(rank, suit));
        }
Ejemplo n.º 12
0
 public Card(int idx)
 {
     _iCard = idx;
     _iSuit = idx / 13;
     _iRank = idx % 13;
     _eSUIT = (SUIT)(0x10000 << _iSuit);
     _eRANK = (RANK)(0x1 << _iRank);
 }
Ejemplo n.º 13
0
    // Start is called before the first frame update
    void Start()
    {
        //ボタン
        NotesKeyName = KeyCode.Space;
        footPosNum   = 0;

        rankJudge = RANK.Bad;
    }
Ejemplo n.º 14
0
        public async Task <ActionResult> DeleteConfirmed(string id)
        {
            RANK rank = await db.RANKs.FindAsync(id);

            db.RANKs.Remove(rank);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 15
0
    // Start is called before the first frame update
    void Start()
    {
        seObj = GameObject.Find("SE");

        NotesKeyName = KeyCode.Space;   //判定するボタン
        footPosNum   = 0;               //足の位置の初期向き

        rankJudge = RANK.Through;       //ランクの初期化
    }
Ejemplo n.º 16
0
    private void CheckTouch()
    {
        if (!_isUsed)
        {
            return;
        }

        if (!Input.GetMouseButtonDown(0))
        {
            return;
        }
        //Debug.Log("SUCCESS TOUCH");

        if (isIndication())
        {
            return;
        }
        //Debug.Log("SUCCESS Indication");

        float distance = SimilarDistance(transform.position, _finishPos);

        //Debug.Log("B : " + distance);

        if (distance > RANK_BAD)
        {
            return;
        }

        //아래부터는 판정 완료

        RANK rank = RANK.MISS;

        if (distance < RANK_BAD)
        {
            rank = RANK.BAD;
        }
        if (distance < RANK_GOOD)
        {
            rank = RANK.GOOD;
        }
        if (distance < RANK_GREAT)
        {
            rank = RANK.GREAT;
        }
        if (distance < RANK_PERFECT)
        {
            rank = RANK.PERFECT;
        }

        StartCoroutine(_noteM.ViewRank(rank.ToString()));
        _noteM.ViewScore(RankToScore(rank));
        _noteM.ViewCombo(rank != RANK.BAD); // BAD가 아니라면 콤보 유지
        _noteM.PlayNote(_index);

        _isChecked = true;
    }
Ejemplo n.º 17
0
    public void changeResult(int time, int correct)
    {
        int  allQ = GMS_.Qnumber;
        RANK rank = calcRank(allQ, correct);

        time_t.text    = time + "s";
        correct_t.text = correct + "/" + allQ;
        rank_t.text    = rank.ToString();
        comment_t.text = RankComment[(int)rank];
    }
Ejemplo n.º 18
0
    //タイミングの評価の処理
    void RankJudge()
    {
        //リストがないときには実行しないようにする
        if (notesLeftList.Count != 0)
        {
            //生成したオブジェクトのローカル回転データ格納
            Vector3 roll = notesLeftList[0].transform.localRotation.eulerAngles;

            //トリガーがオンになったら実行
            if (OnTrigger())
            {
                //ランクの判定
                if (roll.y > butPos.y && roll.y <= gootPos.y)
                {
                    //Debug.Log("Bad!!");
                    rank = RANK.Bad;

                    //SE
                    SE_Manager.SePlay(SE_Manager.SE_NAME.But);
                }
                else if (roll.y > gootPos.y && roll.y <= excellentPos.y)
                {
                    //Debug.Log("Good!!");
                    rank = RANK.Good;

                    //SE
                    SE_Manager.SePlay(SE_Manager.SE_NAME.Good);
                }
                else if (roll.y > excellentPos.y || roll.y <= 0.5)
                {
                    //Debug.Log("Excellent!!");
                    rank = RANK.Excellent;

                    //SE
                    SE_Manager.SePlay(SE_Manager.SE_NAME.Excellent);
                }

                //バッドからエクセレント内にある場合ノーツを消去する
                if (roll.y > butPos.y || roll.y <= 1)
                {
                    DestroyNotes(notesRightList);
                    DestroyNotes(notesLeftList);
                }
                else
                {
                    rank = RANK.Miss;
                }
            }
        }
    }
Ejemplo n.º 19
0
        public async Task <ActionResult> Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RANK rank = await db.RANKs.FindAsync(id);

            if (rank == null)
            {
                return(HttpNotFound());
            }
            return(View(rank));
        }
Ejemplo n.º 20
0
        public Card(SUIT suit, RANK rank)
        {
            _eSUIT = suit;
            _eRANK = rank;

            switch (suit)
            {
            case SUIT.D: _iSuit = 0; break;

            case SUIT.C: _iSuit = 1; break;

            case SUIT.H: _iSuit = 2; break;

            case SUIT.S: _iSuit = 3; break;
            }

            switch (rank)
            {
            case RANK._2: _iRank = 0; break;

            case RANK._3: _iRank = 1; break;

            case RANK._4: _iRank = 2; break;

            case RANK._5: _iRank = 3; break;

            case RANK._6: _iRank = 4; break;

            case RANK._7: _iRank = 5; break;

            case RANK._8: _iRank = 6; break;

            case RANK._9: _iRank = 7; break;

            case RANK._T: _iRank = 8; break;

            case RANK._J: _iRank = 9; break;

            case RANK._Q: _iRank = 10; break;

            case RANK._K: _iRank = 11; break;

            case RANK._A: _iRank = 12; break;
            }

            _iCard = _iSuit * 13 + _iRank;
        }
Ejemplo n.º 21
0
 void scorejudge()
 {
     //評価によって結果を判定する
     if (soumenCount <= ryou)
     {
         scoreRank = RANK.Huka;
     }
     else if (soumenCount <= rank.yuu)
     {
         scoreRank = RANK.Ryou;
     }
     else if (soumenCount <= rank.syuu)
     {
         scoreRank = RANK.Yuu;
     }
     else
     {
         scoreRank = RANK.Syuu;
     }
 }
Ejemplo n.º 22
0
    private int RankToScore(RANK rank)
    {
        switch (rank)
        {
        case RANK.BAD:
            return(10);

        case RANK.GOOD:
            return(55);

        case RANK.GREAT:
            return(130);

        case RANK.PERFECT:
            return(200);

        default:
            return(0);
        }
    }
Ejemplo n.º 23
0
        /// <summary>
        /// Id와 Pwd를 받아 User를 찾는 함수
        /// </summary>
        /// <param name="id"></param>
        /// <param name="pwd"></param>
        /// <returns>검색이 성공하면 검색된 객체를 반환, id가 존재하지 않으면 score = -2인 객체 반환, 아니면 score = -1인 객체 반환</returns>
        public UserInfo GetUser(string id, string pwd)
        {
            UserInfo result;

            try
            {
                string cmdStr = string.Format("select num from user where id=\"{0}\";", id);
                cmd    = new OdbcCommand(cmdStr, conn);
                reader = cmd.ExecuteReader();

                if (!reader.Read())
                {
                    result = new UserInfo(0, "", -2, RANK.UnRank);

                    return(result);
                }

                cmdStr = string.Format("select num, nick, score, rank from user where id=\"{0}\" and pwd=\"{1}\";", id, pwd);
                cmd    = new OdbcCommand(cmdStr, conn);
                reader = cmd.ExecuteReader();

                if (reader.Read())
                {
                    int    index = reader.GetInt32(0);
                    string name  = reader.GetString(1);
                    int    score = reader.GetInt32(2);
                    RANK   rank  = (RANK)reader.GetInt32(3);
                    result = new UserInfo(index, name, score, rank);

                    return(result);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            result = new UserInfo(0, "", -1, RANK.UnRank);

            return(result);
        }
Ejemplo n.º 24
0
 public void setCard(RANK rank, SUIT suit)
 {
     this.rank = (int)rank;
     this.suit = (int)suit;
 }
Ejemplo n.º 25
0
 public Card(RANK rank, SUIT suit)
 {
     this.rank = rank;
     this.suit = suit;
 }
Ejemplo n.º 26
0
    // Update is called once per frame
    void Update()
    {
        if (BeatUi.isNotesPopUp)
        {
            //listObj = BeatUi.notesLefts;
            notesLeftPos  = BeatUi.notesLefts[0].GetComponent <RectTransform>().localPosition.x;
            notesRightPos = BeatUi.notesRights[0].GetComponent <RectTransform>().localPosition.x;

            //ボタン判定
            footPosNum = FootPosNumDebug();
            //Debug.Log(footPosNum);
            //footPosNum = FootPosNum();

            //左のノーツの処理
            if (notesLeftPos >= -150f && notesLeftPos < 100f)
            {
                obj = BeatUi.notesLefts[0];

                //足が地面に接触したときまたはキーボードから入力されたときに処理する
                if (Input.GetKeyDown(NotesKeyName))
                {
                }
                if (StepDetermination.isGroundTouch_R == StepDetermination.ISGROUNDTOUCH.Landing)
                {
                    NotesProcess();
                }
                if (StepDetermination.isGroundTouch_L == StepDetermination.ISGROUNDTOUCH.Landing)
                {
                    NotesProcess();
                }
            }


            //ノーツを消す
            if (notesLeftPos > 2f)
            {
                obj.GetComponent <Image>().color = Color.clear;
            }
            if (notesLeftPos > 100f)
            {
                BeatUi.notesLefts.RemoveAt(0);
                Destroy(obj);
            }


            //右のノーツの処理
            if (notesRightPos <= 150f && notesRightPos > -100f)
            {
                obj1 = BeatUi.notesRights[0];

                if (Input.GetKeyDown(NotesKeyName))
                {
                }
                if (StepDetermination.isGroundTouch_R == StepDetermination.ISGROUNDTOUCH.Landing)
                {
                    //処理を返す(地面に接触したときにフラグを返す)
                    StepDetermination.isGroundTouch_R = StepDetermination.ISGROUNDTOUCH.EndProcess;
                    BeatUi.notesRights.RemoveAt(0);
                    Destroy(obj1);
                }
                else if (StepDetermination.isGroundTouch_L == StepDetermination.ISGROUNDTOUCH.Landing)
                {
                    //処理を返す(地面に接触したときにフラグを返す)
                    StepDetermination.isGroundTouch_L = StepDetermination.ISGROUNDTOUCH.EndProcess;
                    BeatUi.notesRights.RemoveAt(0);
                    Destroy(obj1);
                }
                //BeatUi.notesRights.RemoveAt(0);
                //Destroy(obj1);
            }
            if (!Input.GetKeyDown(NotesKeyName) || !Input.anyKeyDown)
            {
                if (notesRightPos < -2f)
                {
                    obj1.GetComponent <Image>().color = Color.clear;
                }
                if (notesRightPos < -100f)
                {
                    BeatUi.notesRights.RemoveAt(0);
                    Destroy(obj1);

                    //スルーした時のランク
                    rankJudge = RANK.Through;
                }
            }
        }
    }
Ejemplo n.º 27
0
 public void setRank(RANK rank)
 {
     this.rank = (int)rank;
 }
Ejemplo n.º 28
0
 public Card(RANK rank, SUITE suite)
 {
     r = rank;
     s = suite;
 }
Ejemplo n.º 29
0
 public Card(RANK _rank, SUIT _suit)
 {
     Rank = _rank;
     Suit = _suit;
 }
Ejemplo n.º 30
0
 public Card()
 {
     Rank = RANK.Small;
     Suit = SUIT.Joker;
 }
Ejemplo n.º 31
0
 public Card(RANK rank, SUIT suit)
 {
     this._rank = rank;
     this._suit = suit;
 }
Ejemplo n.º 32
0
        public Actions GetMove()
        {
            if (_actions.Count() == 1)
            {
                return(_actions[0]);
            }
            else if (_actions.Count() > 1)
            {
                #region You have an ace and...
                if (_player.Any(x => x.rank == RANK.RA) && _player.Count() == 2)
                {
                    var  secondCard = _player.Where(x => x.rank != RANK.RA).FirstOrDefault();
                    RANK r          = secondCard == null ? RANK.RA : secondCard.rank;

                    switch (r)
                    {
                    case RANK.RA: return(Actions.SPLIT);

                    case RANK.R2:
                    case RANK.R3:
                        if (_dealer.Any(x => x.rank == RANK.R5 || x.rank == RANK.R6))
                        {
                            return(Actions.DOUBLE);
                        }
                        else
                        {
                            return(Actions.HIT);
                        }

                    case RANK.R4:
                    case RANK.R5:
                        if (_dealer.Any(x => x.rank == RANK.R4 || x.rank == RANK.R5 || x.rank == RANK.R6))
                        {
                            return(Actions.DOUBLE);
                        }
                        else
                        {
                            return(Actions.HIT);
                        }

                    case RANK.R6:
                        if (_dealer.Any(x => x.rank == RANK.R3 || x.rank == RANK.R4 || x.rank == RANK.R5 || x.rank == RANK.R6))
                        {
                            return(Actions.DOUBLE);
                        }
                        else
                        {
                            return(Actions.HIT);
                        }

                    case RANK.R7:
                        if (_dealer.Any(x => x.rank == RANK.R3 || x.rank == RANK.R4 || x.rank == RANK.R5 || x.rank == RANK.R6))
                        {
                            return(Actions.DOUBLE);
                        }
                        else if (_dealer.Any(x => x.rank == RANK.R2 || x.rank == RANK.R7 || x.rank == RANK.R8))
                        {
                            return(Actions.STAND);
                        }
                        else
                        {
                            return(Actions.HIT);
                        }

                    case RANK.R8:
                    case RANK.R9:
                    case RANK.RT:
                    case RANK.RJ:
                    case RANK.RQ:
                    case RANK.RK:
                        return(Actions.STAND);

                    default:
                        throw new Exception("Logic error");
                    }
                }
                #endregion

                #region You have a pair of...

                if (_player.Count == 2 && _player[0].rank == _player[1].rank)
                {
                    switch (_player[0].rank)
                    {
                    case RANK.RA: return(Actions.STAND);

                    case RANK.R2:
                    case RANK.R3:
                        if (_dealer.Any(x => x.rank == RANK.R4 || x.rank == RANK.R5 || x.rank == RANK.R6 || x.rank == RANK.R7))
                        {
                            return(Actions.SPLIT);
                        }
                        else
                        {
                            return(Actions.HIT);
                        }

                    case RANK.R4:
                        return(Actions.HIT);

                    case RANK.R5:
                        if (_dealer.Any(x => x.rank >= RANK.R2 && x.rank <= RANK.R9))
                        {
                            return(Actions.DOUBLE);
                        }
                        else
                        {
                            return(Actions.HIT);
                        }

                    case RANK.R6:
                        if (_dealer.Any(x => x.rank == RANK.R3 || x.rank == RANK.R4 || x.rank == RANK.R5 || x.rank == RANK.R6))
                        {
                            return(Actions.SPLIT);
                        }
                        else
                        {
                            return(Actions.HIT);
                        }

                    case RANK.R7:
                        if (_dealer.Any(x => x.rank >= RANK.R2 && x.rank <= RANK.R7))
                        {
                            return(Actions.SPLIT);
                        }
                        else
                        {
                            return(Actions.HIT);
                        }

                    case RANK.R8:
                        return(Actions.SPLIT);

                    case RANK.R9:
                        if (_dealer.Any(x => x.rank >= RANK.R2 && x.rank <= RANK.R6))
                        {
                            return(Actions.SPLIT);
                        }
                        else if (_dealer.Any(x => x.rank == RANK.R7))
                        {
                            return(Actions.STAND);
                        }
                        else if (_dealer.Any(x => x.rank == RANK.R8 || x.rank == RANK.R9))
                        {
                            return(Actions.SPLIT);
                        }
                        else
                        {
                            return(Actions.STAND);
                        }

                    case RANK.RT:
                    case RANK.RJ:
                    case RANK.RQ:
                    case RANK.RK:
                        return(Actions.STAND);

                    default:
                        throw new Exception("Logic error");
                    }
                }

                #endregion

                #region or You have...

                if (_player.Count > 0)
                {
                    int sum = CalcSum(_player);
                    if (sum >= 21)
                    {
                        return(Actions.BET);
                    }
                    else if (sum <= 8)
                    {
                        return(Actions.HIT);
                    }
                    else if (sum == 9)
                    {
                        if (_dealer.Any(x => x.rank == RANK.R3 || x.rank == RANK.R4 || x.rank == RANK.R5 || x.rank == RANK.R6))
                        {
                            return(Actions.DOUBLE);
                        }
                        else
                        {
                            return(Actions.HIT);
                        }
                    }
                    else if (sum == 10)
                    {
                        if (_dealer.Any(x => x.rank >= RANK.R2 && x.rank <= RANK.R9))
                        {
                            return(Actions.DOUBLE);
                        }
                        else
                        {
                            return(Actions.HIT);
                        }
                    }
                    else if (sum == 11)
                    {
                        if (_dealer.Any(x => x.rank == RANK.RA))
                        {
                            return(Actions.HIT);
                        }
                        else
                        {
                            return(Actions.DOUBLE);
                        }
                    }
                    else if (sum == 12)
                    {
                        if (_dealer.Any(x => x.rank >= RANK.R4 && x.rank <= RANK.R6))
                        {
                            return(Actions.STAND);
                        }
                        else
                        {
                            return(Actions.HIT);
                        }
                    }
                    else if (sum >= 13 && sum <= 16)
                    {
                        if (_dealer.Any(x => x.rank >= RANK.R2 && x.rank <= RANK.R6))
                        {
                            return(Actions.STAND);
                        }
                        else
                        {
                            return(Actions.HIT);
                        }
                    }
                    else if (sum >= 17 && sum <= 21)
                    {
                        return(Actions.STAND);
                    }
                }

                #endregion
            }
            throw new Exception("Logic error");
        }
Ejemplo n.º 33
0
 public void setCard(RANK rank, SUIT suit)
 {
     this.rank = (int)rank;
     this.suit = (int)suit;
 }
Ejemplo n.º 34
0
 public Card(Card card)
 {
     rank = card.rank;
     suit = card.suit;
 }
Ejemplo n.º 35
0
 public UserInfo(string name, int score, RANK rank)
 {
     Name  = name;
     Score = score;
     Rank  = rank;
 }
Ejemplo n.º 36
0
 public void setRank(RANK rank)
 {
     this.rank = (int)rank;
 }
Ejemplo n.º 37
0
 public Card(SUIT suit, RANK rank)
 {
     Suit = suit;
     Rank = rank;
 }
Ejemplo n.º 38
0
 public Card(SUIT suit, RANK rank)
 {
     this._suit = suit;
     this._rank = rank;
 }