Beispiel #1
0
 public void DoServerHundredUpdate()
 {   //收到伺服器傳來名單 更新近百局名單
     HundredData = new List <SicBoDiceData>();
     foreach (var item in SicBoManager.RecentHundredData.m_listAwardList)
     {   //名單轉存到陣列
         SicBoDiceData tmpDice = new SicBoDiceData();
         tmpDice.Dice1 = item.m_byarDiceNumber[0];
         tmpDice.Dice2 = item.m_byarDiceNumber[1];
         tmpDice.Dice3 = item.m_byarDiceNumber[2];
         tmpDice.Dice4 = item.m_byarDiceNumber[3];
         HundredData.Add(tmpDice);
     }
     HundredData.Reverse();     //反轉List 新的在前
     print("百局名單轉換完畢  HundredDataCount = " + HundredData.Count);
     ServerHundredConversion(); //根據根據伺服器給的資料轉換成List資料
 }
Beispiel #2
0
    public void UpdateHundredArray(byte dice1, byte dice2, byte dice3, byte dice4)
    {   //更新近百局
        SicBoDiceData tmpDice = new SicBoDiceData();

        tmpDice.Dice1 = dice1;
        tmpDice.Dice2 = dice2;
        tmpDice.Dice3 = dice3;
        tmpDice.Dice4 = dice4;

        //如果資料筆數有一百 刪除舊資料 再新增新資料  否則 直接新增
        if (HundredData.Count == 100)
        {
            HundredConversion(false, HundredData[99]); //減去最後一筆資料的開獎數
            HundredData.RemoveAt(99);                  //刪除最後一筆骰子資料
        }
        HundredData.Insert(0, tmpDice);                //插入新資料
        HundredConversion(true, HundredData[0]);       //增加新資料的開獎數
    }
Beispiel #3
0
 void HundredConversion(bool Addition, SicBoDiceData tmpDice)
 {                                                       //根據 增減模式(Addition) 與 骰子內容(tmpDice),增減 RecentHundredbyte
     if (tmpDice.Dice1 == tmpDice.Dice2 && tmpDice.Dice1 == tmpDice.Dice3 && tmpDice.Dice1 == tmpDice.Dice4)
     {                                                   //四豹  1111 = 111 四枚 圍骰
         if (Addition)
         {                                               //增加
             RecentHundredbyte[tmpDice.Dice1 + 1]++;     //圍骰 1~6 + 1 = 2 ~ 7
             RecentHundredbyte[8]++;                     //任意圍骰
             RecentHundredbyte[tmpDice.Dice1 + 8]++;     //四枚 1~6 + 8 = 9 ~ 14
             RecentHundredbyte[15]++;                    //任意四枚
             RecentHundredbyte[tmpDice.Dice1 + 29] += 4; //Number 1~6 + 29 = 30 ~ 35
             if (tmpDice.Dice1 != 1 && tmpDice.Dice1 != 6)
             {
                 RecentHundredbyte[12 + tmpDice.Dice1 * 3]++; //Total 12 + Dice*3 = 18 21 24 27
             }
         }
         else
         {                                               //減少
             RecentHundredbyte[tmpDice.Dice1 + 1]--;     //圍骰 1~6 + 1 = 2 ~ 7
             RecentHundredbyte[8]--;                     //任意圍骰
             RecentHundredbyte[tmpDice.Dice1 + 8]--;     //四枚 1~6 + 8 = 9 ~ 14
             RecentHundredbyte[15]--;                    //任意四枚
             RecentHundredbyte[tmpDice.Dice1 + 29] -= 4; //Number 1~6 + 29 = 30 ~ 35
             if (tmpDice.Dice1 != 1 && tmpDice.Dice1 != 6)
             {
                 RecentHundredbyte[12 + tmpDice.Dice1 * 3]--; //Total 12 + Dice*3 = 18 21 24 27
             }
         }
     }
     else if (tmpDice.Dice1 == tmpDice.Dice2 && tmpDice.Dice1 == tmpDice.Dice3 && tmpDice.Dice1 != tmpDice.Dice4 && tmpDice.Dice4 != 0)
     {                                                   //破骰 1112 = 111 & 112
         if (Addition)
         {                                               //增加
             RecentHundredbyte[tmpDice.Dice1 + 1]++;     //圍骰 1~6 + 1 = 2 ~ 7
             RecentHundredbyte[8]++;                     //任意圍骰
             RecentHundredbyte[tmpDice.Dice1 + 29] += 3; //Number 1~6 + 29 = 30 ~ 35
             RecentHundredbyte[tmpDice.Dice4 + 29] += 1; //Number 1~6 + 29 = 30 ~ 35
             byte tmpTotal = (byte)(tmpDice.Dice1 + tmpDice.Dice2 + tmpDice.Dice3);
             if (tmpTotal >= 4 && tmpTotal <= 17)        //Total 1
             {
                 RecentHundredbyte[12 + tmpTotal]++;
             }
             tmpTotal = (byte)(tmpDice.Dice1 + tmpDice.Dice2 + tmpDice.Dice4);
             if (tmpTotal >= 4 && tmpTotal <= 17)    //Total 2
             {
                 RecentHundredbyte[12 + tmpTotal]++;
             }
             if (tmpTotal >= 4 && tmpTotal <= 10)    //小
             {
                 RecentHundredbyte[0]++;
             }
             else if (tmpTotal >= 11 && tmpTotal <= 17)  //大
             {
                 RecentHundredbyte[1]++;
             }
         }
         else
         {                                               //減少
             RecentHundredbyte[tmpDice.Dice1 + 1]--;     //圍骰 1~6 + 1 = 2 ~ 7
             RecentHundredbyte[8]--;                     //任意圍骰
             RecentHundredbyte[tmpDice.Dice1 + 29] -= 3; //Number 1~6 + 29 = 30 ~ 35
             RecentHundredbyte[tmpDice.Dice4 + 29] -= 1; //Number 1~6 + 29 = 30 ~ 35
             byte tmpTotal = (byte)(tmpDice.Dice1 + tmpDice.Dice2 + tmpDice.Dice3);
             if (tmpTotal >= 4 && tmpTotal <= 17)        //Total 1
             {
                 RecentHundredbyte[12 + tmpTotal]--;
             }
             tmpTotal = (byte)(tmpDice.Dice1 + tmpDice.Dice2 + tmpDice.Dice4);
             if (tmpTotal >= 4 && tmpTotal <= 17)    //Total 2
             {
                 RecentHundredbyte[12 + tmpTotal]--;
             }
             if (tmpTotal >= 4 && tmpTotal <= 10)    //小
             {
                 RecentHundredbyte[0]--;
             }
             else if (tmpTotal >= 11 && tmpTotal <= 17)  //大
             {
                 RecentHundredbyte[1]--;
             }
         }
     }
     else if (tmpDice.Dice1 == tmpDice.Dice2 && tmpDice.Dice1 == tmpDice.Dice3 && tmpDice.Dice4 == 0)
     {                                                   //普豹
         if (Addition)
         {                                               //增加
             RecentHundredbyte[tmpDice.Dice1 + 1]++;     //圍骰 1~6 + 1 = 2 ~ 7
             RecentHundredbyte[8]++;                     //任意圍骰
             RecentHundredbyte[tmpDice.Dice1 + 29] += 3; //Number 1~6 + 29 = 30 ~ 35
             if (tmpDice.Dice1 != 1 && tmpDice.Dice1 != 6)
             {
                 RecentHundredbyte[12 + tmpDice.Dice1 * 3]++; //Total 12 + Dice*3 = 18 21 24 27
             }
         }
         else
         {                                               //減少
             RecentHundredbyte[tmpDice.Dice1 + 1]--;     //圍骰 1~6 + 1 = 2 ~ 7
             RecentHundredbyte[8]--;                     //任意圍骰
             RecentHundredbyte[tmpDice.Dice1 + 29] -= 3; //Number 1~6 + 29 = 30 ~ 35
             if (tmpDice.Dice1 != 1 && tmpDice.Dice1 != 6)
             {
                 RecentHundredbyte[12 + tmpDice.Dice1 * 3]--; //Total 12 + Dice*3 = 18 21 24 27
             }
         }
     }
     else
     {                                                //其他
         if (Addition)
         {                                            //增加
             RecentHundredbyte[tmpDice.Dice1 + 29]++; //Number 1~6 + 29 = 30 ~ 35
             RecentHundredbyte[tmpDice.Dice2 + 29]++; //Number 1~6 + 29 = 30 ~ 35
             RecentHundredbyte[tmpDice.Dice3 + 29]++; //Number 1~6 + 29 = 30 ~ 35
             byte tmpTotal = (byte)(tmpDice.Dice1 + tmpDice.Dice2 + tmpDice.Dice3);
             if (tmpTotal >= 4 && tmpTotal <= 17)     //Total
             {
                 RecentHundredbyte[12 + tmpTotal]++;
             }
             if (tmpTotal >= 4 && tmpTotal <= 10)    //小
             {
                 RecentHundredbyte[0]++;
             }
             else if (tmpTotal >= 11 && tmpTotal <= 17)  //大
             {
                 RecentHundredbyte[1]++;
             }
         }
         else
         {                                            //減少
             RecentHundredbyte[tmpDice.Dice1 + 29]--; //Number 1~6 + 29 = 30 ~ 35
             RecentHundredbyte[tmpDice.Dice2 + 29]--; //Number 1~6 + 29 = 30 ~ 35
             RecentHundredbyte[tmpDice.Dice3 + 29]--; //Number 1~6 + 29 = 30 ~ 35
             byte tmpTotal = (byte)(tmpDice.Dice1 + tmpDice.Dice2 + tmpDice.Dice3);
             if (tmpTotal >= 4 && tmpTotal <= 17)     //Total
             {
                 RecentHundredbyte[12 + tmpTotal]--;
             }
             if (tmpTotal >= 4 && tmpTotal <= 10)    //小
             {
                 RecentHundredbyte[0]--;
             }
             else if (tmpTotal >= 11 && tmpTotal <= 17)  //大
             {
                 RecentHundredbyte[1]--;
             }
         }
     }
 }