Exemplo n.º 1
0
    //void OnGUI()
    //{
    //    if (flag)
    //    {
    //        if (GUI.Button(new Rect(300, 10, 100, 20), "CPU turn draw"))
    //        {
    //            get();
    //            if (tP != 0)
    //            {
    //                if (moveFlag || flashFlag) return;  //待機処理中にもう一回押された時に無効化
    //                drawWithAnimation(dP,draw(dP),tP);
    //            }
    //        }
    //    }
    //}

    public void OnClickComDraw()  //for iOS
    {
        get();
        if (md.playerInfo[tP] == "Com" && md.IsHost()) //master player のみがコンピューター操作できるように、後でIsHostにしよう
        {
            if (moveFlag || flashFlag)
            {
                return;                       //待機処理中にもう一回押された時に無効化
            }
            int drawncard = record.Uniform[coms[tP].draw(dP)];
            drawWithAnimation(dP, drawncard, tP);
        }
    }
Exemplo n.º 2
0
 void Start()
 {
     Debug.Log("zizideck called");
     md = GameObject.Find("ModeData").GetComponent <ModeData>();
     if (!md.IsSolo() && md.IsHost())
     {
         seed = UnityEngine.Random.Range(0, 10000);
         PhotonView view = GetComponent <PhotonView>();
         ShufflePlayers(md.numOfPlayer);
         view.RPC("SendSeed", PhotonTargets.All, seed, md.numOfPlayer, md.playerInfo);
     }
     else if (md.IsSolo())
     {
         Shuffle();
     }
 }
Exemplo n.º 3
0
 // Start is called before the first frame update
 void Start()
 {
     md = GameObject.Find("ModeData").GetComponent <ModeData>();
     if (!md.IsHost() && !md.IsSolo())
     {
         comDrawbtn.SetActive(false);
     }
     if (md.IsSolo())
     {
         comDrawbtn.SetActive(true);
     }
     canvasStart = GameObject.Find("Canvas_0");
     canvasStart.SetActive(true);
     setP = GameObject.Find("SettingPanel");
     setP.SetActive(false);
     setB = GameObject.Find("SettingButton");
     setB.SetActive(true);
     gameoverP = GameObject.Find("GameOverPanel");
     gameoverP.SetActive(false);
     //debugP = GameObject.Find("debugPanel");
     //debugP.SetActive(false);
 }
Exemplo n.º 4
0
    //comじじかく
    public void ComZizikaku(int card, int com)
    {
        if (!md.IsHost() || md.playerInfo[com] != "Com")
        {
            return;
        }
        if (tm.gameOver)
        {
            return;              //ゲーム終了後はじじかくできない
        }
        comgListString = "";
        if (card < 10)
        {
            comgListString += "0" + card.ToString();
        }
        else
        {
            comgListString += card.ToString();
        }
        PhotonView view = GetComponent <PhotonView>();

        view.RPC("SendGuessList", PhotonTargets.All, tm.turn, com, comgListString);
    }
Exemplo n.º 5
0
    public void WriteResult(List <int> wins, int zizi)
    {
        List <int> scoreToOrder = new List <int>()
        {
            120, 70, 60, 0
        };
        List <int> zzkkscoreToOrder = new List <int>()
        {
            120, 90, 60, 30
        };

        canvas4.SetActive(false);
        gameoverP.SetActive(true);
        score     = md.score;
        zzkkscore = new List <int> {
            0, 0, 0, 0
        };
        string[] playerInfo    = md.playerInfo;
        string[] prePlayerInfo = md.prePlayerInfo;
        string   order;
        string   points;

        for (int i = 0; i < 4; i++)
        {
            //じじかくぼたんおさなかった場合の処置やけどそもそもzzkkList[3]とかがなかってもいいのかな?
            //無理そうならSendGuessList()でInsertやめてAddにしてもう一ループしてzzkkList再編する
            if (zzkkList[i] == null)
            {
                zzkkList[i] = new List <int> {
                    1000
                }
            }
            ;
            else
            {
                if (!zzkkList[i].Contains(zizi))
                {
                    zzkkList[i][0] = 1000;
                }
            }
        }
        for (int i = 0; i < 4; i++)
        {
            for (int j = 0; j < 4; j++)
            {
                if (zzkkList[i][0] > zzkkList[j][0]) //ターン番号の小さいものがあれば
                {
                    zzkkrank[i] += 1;
                }
            }
            if (zzkkList[i][0] == 1000)
            {
                zzkkscore[i] = 0;                         //じじかくボタン押さなかった場合もこっちに入る
            }
            else
            {
                zzkkscore[i] += zzkkscoreToOrder[zzkkrank[i]] / (zzkkList[i].Count - 1);
            }
        }

        for (int i = 0; i < 4; i++)
        {
            score[wins[i]] += scoreToOrder[i];
            result.Add("No." + (i + 1) + ": " + playerInfo[wins[i]]);
        }

        order  = result[0] + "\n" + result[1] + "\n" + result[2] + "\n" + result[3];
        points = "\n\n" + playerInfo[0] + ": " + score[0] + " + " + zzkkscore[0] + " pt,     " + playerInfo[1] + ": " + score[1] + " + " + zzkkscore[1] + " pt" + "\n" + playerInfo[2] + ": " + score[2] + " + " + zzkkscore[2] + " pt,     " + playerInfo[3] + ": " + score[3] + " + " + zzkkscore[3] + " pt";
        Text text = GameObject.Find("Results").GetComponent <Text>();

        text.text = order + points;
        for (int i = 0; i < 4; i++)
        {
            score[i] += zzkkscore[i];
        }

        if (!md.IsHost())
        {
            GameObject.Find("RestartButton").SetActive(false);
        }
    }