コード例 #1
0
ファイル: GameController.cs プロジェクト: vladdou/Dominion
        public ActionResult MakeChoice(string choice)
        {
            var message = new ChoiceMessage(Client.PlayerId, choice);

            Client.AcceptMessage(message);
            return(new EmptyResult());
        }
コード例 #2
0
        /// <summary>
        /// ダイアログを表示するトリガーメソッド
        /// </summary>
        public void OnDialog()
        {
            input.rock = true;

            int cost = gamesetup.RemainPoint();
            //表示するメッセージ
            string msg;

            if (cost > 0)
            {
                msg = "設置可能な駒があります  ゲームを開始しますか?";
            }
            else
            {
                msg = "ゲームを開始しますか?";
            }

            //ダイアログの種類 (Choice or Close)
            string kind = "Choice";

            GameObject instance = message_manager.DispDialog(kind, msg);

            if (kind == "Choice")
            {
                choice_message           = instance.transform.GetComponent <ChoiceMessage>();
                choice_message.FixDialog = result => Action(result.ToString());
            }
            else if (kind == "Close")
            {
                close_message           = instance.transform.GetComponent <CloseMessage>();
                close_message.FixDialog = result => Action(result.ToString());
            }
        }
コード例 #3
0
        private void usunOceneToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string markId = this.marksList.FocusedItem.SubItems[0].Text;

            if (ChoiceMessage.Create("Czy na pewno chcesz usunac ocene?", "Pytanie"))
            {
                this.removeMarkById(markId);
            }
        }
コード例 #4
0
        private void RemoveStudent_Click(object sender, EventArgs e)
        {
            string studentId = this.studentsList.FocusedItem.SubItems[0].Text;

            if (ChoiceMessage.Create("Czy na pewno chcesz usunac wybranego studenta?", "Wybieraj"))
            {
                Student.Remove(studentId);
                this.getAllStudents();
            }
        }
コード例 #5
0
        private void RemoveSubject_Click(object sender, EventArgs e)
        {
            string subjectId = this.subjectsList.FocusedItem.SubItems[0].Text;

            if (ChoiceMessage.Create("Czy na pewno chcesz usunac wybrany przedmiot?", "Wybieraj"))
            {
                Subject.Remove(subjectId);
                this.getAllSubjects();
            }
        }
コード例 #6
0
        public void TestChoice()
        {
            ChoiceMessage before = new ChoiceMessage();
            before.Choice = new SmallStructure();
            before.Choice.Small.Test = 123;

            byte[] result = Pincher.Encode(before);

            ChoiceMessage after = Pincher.Decode<ChoiceMessage>(result);

            Assert.AreEqual(ChoiceStructureKind.Small, after.Choice.ValueKind);
            Assert.AreEqual(123, after.Choice.Small.Test);

            Assert.IsNull(before.Choice.OptionalDecimal);
            Assert.IsNull(before.Choice.RequiredDecimal);
            Assert.IsNull(before.Choice.Versioning);
        }
コード例 #7
0
    /// <summary>
    /// ダイアログを表示するトリガーメソッド
    /// </summary>
    public void OnDialog()
    {
        //表示するメッセージ
        string msg = "タイトルへ戻りますか?";

        //ダイアログの種類 (Choice or Close)
        string kind = "Choice";

        GameObject instance = message_manager.DispDialog(kind, msg);

        if (kind == "Choice")
        {
            choice_message           = instance.transform.GetComponent <ChoiceMessage>();
            choice_message.FixDialog = result => Action(result.ToString());
        }
        else if (kind == "Close")
        {
            close_message           = instance.transform.GetComponent <CloseMessage>();
            close_message.FixDialog = result => Action(result.ToString());
        }
    }
コード例 #8
0
        public void TestDynamicDecoding()
        {
            DynamicPincher pincher = new DynamicPincher(@"..\..\TestVersion3.pinch");

            VersioningStructure sample = new VersioningStructure();
            sample.ReqScalar = 1;
            sample.ReqPointer = "Two";
            sample.ReqStructure = new SmallStructure();
            sample.ReqStructure.Test = 3;

            sample.AddedReqScalar = 4;
            sample.AddedReqPointer = "Five";
            sample.AddedReqStructure = new SmallStructure();
            sample.AddedReqStructure.Test = 6;

            byte[] data = Pincher.Encode(sample);

            DynamicStructure structure =
                pincher.Decode("Interlace.Pinch.TestsVersion3.VersioningStructure", data);

            Assert.AreEqual("Five", structure.Members["AddedReqPointer"].Value);

            ChoiceMessage choiceSample = new ChoiceMessage();
            choiceSample.Test = 1234;
            choiceSample.Choice = new SmallStructure();
            choiceSample.Choice.Small.Test = 5;

            byte[] choiceData = Pincher.Encode(choiceSample);

            DynamicStructure choiceStructure =
                pincher.Decode("Interlace.Pinch.TestsVersion3.ChoiceMessage", choiceData);

            Assert.AreEqual(1234, choiceStructure["Test"]);

            DynamicStructure assertStructure = (DynamicStructure)choiceStructure["Choice"];

            Assert.AreEqual(5, assertStructure["Test"]);
        }