コード例 #1
0
ファイル: CardMenu.cs プロジェクト: kakke18/real-life-game
    public void Card3()
    {
        gameObject.SetActive(false);

        int[] whiteMass1 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
        int   k          = 0;

        for (int i = 1; i < 20; i++)
        {
            if (Masses.GetBoardColor(i) == 0)
            {
                whiteMass1[k] = i;
                k++;
            }
        }

        int[] whiteMass2 = new int[k];
        for (int i = 0; i < k; i++)
        {
            whiteMass2[i] = whiteMass1[i];
        }

        int[] whiteMass3 = whiteMass2.OrderBy(i => Guid.NewGuid()).ToArray();
        if (whiteMass2.Length == 1)
        {
            Masses.ChangeMass(whiteMass3[0], "4,5000,5000G");
            Masses.ChangeColor(4, whiteMass3[0]);
        }
        else if (whiteMass2.Length == 0)
        {
            Card3Error.SetTrue();
            card[3]++;
        }
        else
        {
            Masses.ChangeMass(whiteMass3[0], "4,5000,5000G");
            Masses.ChangeColor(4, whiteMass3[0]);
            Masses.ChangeMass(whiteMass3[1], "4,5000,5000G");
            Masses.ChangeColor(4, whiteMass3[1]);
        }

        card[3] -= 1;

        if (card[3] == 0)
        {
            Use3.SetFalse();
        }
    }
コード例 #2
0
    public void MassEffect(int place)
    {
        string[] stArrayData = Masses.board[place].Split(',');

        if (stArrayData[0] == "1")
        {
            PopUpText.ChangeText(int.Parse(stArrayData[0]), int.Parse(stArrayData[1]));
            CardMenu.SetCard(int.Parse(stArrayData[1]));
        }
        else if (stArrayData[0] == "2")
        {
            PopUpText.ChangeText(int.Parse(stArrayData[0]), int.Parse(stArrayData[1]));
            stamina += 1;
            //スタミナをサーバに送信
            if (useServer)
            {
                string send = "4";
                send += stamina.ToString();
                base.sendMessage(ns, send);
            }
        }
        else if (stArrayData[0] == "3")
        {
            if (DoubleGoldFlag)
            {
                PopUpText.ChangeText(int.Parse(stArrayData[0]), 2 * (5000 + 1000 * PartTimeJobCount));
                gold          += 2 * (5000 + 1000 * PartTimeJobCount);
                DoubleGoldFlag = false;

                if (CardMenu.GetCard(2) > 0)
                {
                    Use2.SetTrue();
                }
            }
            else
            {
                PopUpText.ChangeText(int.Parse(stArrayData[0]), 5000 + 1000 * PartTimeJobCount);
                gold += (5000 + 1000 * PartTimeJobCount);
            }

            //ゴールドをサーバに送信
            if (useServer)
            {
                string send = "3";
                send += gold.ToString();
                base.sendMessage(ns, send);
            }

            PartTimeJobCount++;
        }
        else if (stArrayData[0] == "4")
        {
            if (DoubleGoldFlag)
            {
                PopUpText.ChangeText(int.Parse(stArrayData[0]), 2 * (int.Parse(stArrayData[1])));
                gold          += 2 * (int.Parse(stArrayData[1]));
                DoubleGoldFlag = false;

                if (CardMenu.GetCard(2) > 0)
                {
                    Use2.SetTrue();
                }
            }
            else
            {
                PopUpText.ChangeText(int.Parse(stArrayData[0]), int.Parse(stArrayData[1]));
                gold += int.Parse(stArrayData[1]);
            }

            //ゴールドの変更をサーバに送信
            if (useServer)
            {
                base.sendMessage(ns, "3" + gold.ToString());
            }
        }

        if (stArrayData[0] != "0")
        {
            MassEffectPopUp.SetTrue();
            Masses.ChangeColor(0, place);
        }
        Masses.ChangeMass(place, "10");

        //盤面情報の変更をサーバに送信
        if (useServer)
        {
            string sendMsg = "";
            for (int i = 0; i < 20; i++)
            {
                sendMsg += Masses.board[i];
                if (i != 19)
                {
                    sendMsg += ":";
                }
            }
            base.sendMessage(ns, "2" + sendMsg);
        }
    }