Esempio n. 1
0
 private void procEvent(EventData d)
 {
     if (gs != null)
     {
         if (OneObject.PerformEvent(gs, d.data))
         {
             updateTimer2.Enabled = true;
         }
     }
 }
Esempio n. 2
0
        //一度だけ作成されるオブジェクトを更新する
        protected void UpdateStaticObject()
        {
            this.Controls.Add(phaseCaption);
            this.Controls.Add(objCaption);
            this.Controls.Add(debugBt1);
            this.Controls.Add(debugBt2);
            this.Controls.Add(labelC);
            this.Controls.Add(labelT);

            // フラッグを並べる
            for (int i = 0; i < Defines.NumOfFlag; i++)
            {
                Flag       f   = gs.GetFlag(i);
                FlagObject obj = new FlagObject(flagPt[i], f);
                obj.MouseEnter += new EventHandler(ShowCaption);
                obj.MouseLeave += new EventHandler(HideCaption);
                obj.MouseDown  += new MouseEventHandler(MouseDownEvent);
                this.Controls.Add(obj);
            }
            // ボタンとかを並べる
            Size sz = new Size(Defines.CardSizeX, Defines.CardSizeY);

            OneObject [] objList =
            {
                new OneObject(etcPt[0], Defines.ImageName.TroopStack,   sz),
                new OneObject(etcPt[1], Defines.ImageName.TacticsStack, sz),
//				new OneObject(etcPt[2],Defines.ImageName.LabelReset, new Size(64,32)),
                new OneObject(etcPt[3], Defines.ImageName.LabelNext,    new Size(64, 32)),
                new OneObject(etcPt[4], Defines.ImageName.LabelUse,     new Size(64, 32)),
                new OneObject(etcPt[5], Defines.ImageName.LabelDestroy, new Size(64, 32)),
            };
            foreach (OneObject obj in objList)
            {
                obj.MouseEnter += new EventHandler(ShowCaption);
                obj.MouseLeave += new EventHandler(HideCaption);
                obj.MouseDown  += new MouseEventHandler(MouseDownEvent);
            }
            this.Controls.AddRange(objList);
            //セレクトボックス
            OneObject o = new OneObject(etcPt[7], Defines.ImageName.SelectBox, new Size(96, 96));

            this.Controls.Add(o);
            //リセットスイッチ
            o             = new OneObject(etcPt[2], Defines.ImageName.LabelReset, new Size(64, 32));
            o.MouseEnter += new EventHandler(ShowCaption);
            o.MouseLeave += new EventHandler(HideCaption);
            o.MouseDown  += new MouseEventHandler(ResetEvent);
            this.Controls.Add(o);
        }
Esempio n. 3
0
        //ゲーム状態によって変わるオブジェクトを更新する
        protected void UpdateChanged()
        {
            ArrayList addList    = new ArrayList();
            ArrayList deleteList = new ArrayList();
            // 自分の手札を並べる
            int i = 0;

            foreach (Card c in gs.GetHand(mySide))
            {
                CardObject obj = new CardObject(myHandPt[i], c, true);
                obj.MouseEnter += new EventHandler(ShowCaption);
                obj.MouseLeave += new EventHandler(HideCaption);
                obj.MouseDown  += new MouseEventHandler(MouseDownEvent);
                addList.Add(obj);
                i++;
            }
            // 相手の手札を並べる
            i = 0;
            foreach (Card c in gs.GetHand(yourSide))
            {
                CardObject obj = new CardObject(yourHandPt[i], c, isDebug);
                if (isDebug)
                {
                    obj.MouseDown += new MouseEventHandler(MouseDownEvent);
                }
                addList.Add(obj);
                i++;
            }
            // 場にあるカードとエフェクトを並べる
            for (i = 0; i < Defines.NumOfFlag; i++)
            {
                Flag f = gs.GetFlag(i);
                int  j = 0;
                foreach (Card c in f.GetCard(mySide))
                {
                    Point      pt  = new Point(flagPt[i].X, myCPtY[j]);
                    CardObject obj = new CardObject(pt, c, true);
                    obj.MouseEnter += new EventHandler(ShowCaption);
                    obj.MouseLeave += new EventHandler(HideCaption);
                    obj.MouseDown  += new MouseEventHandler(MouseDownEvent);
                    addList.Add(obj);
                    j++;
                }
                j = 0;
                foreach (Card c in f.GetCard(yourSide))
                {
                    Point      pt  = new Point(flagPt[i].X, yourCPtY[j]);
                    CardObject obj = new CardObject(pt, c, true);
                    obj.MouseEnter += new EventHandler(ShowCaption);
                    obj.MouseLeave += new EventHandler(HideCaption);
                    obj.MouseDown  += new MouseEventHandler(MouseDownEvent);
                    addList.Add(obj);
                    j++;
                }
                if (f.Winner == mySide)
                {
                    Point     pt  = new Point(etcPt[6].X + flagPt[i].X, etcPt[6].Y + flagPt[i].Y);
                    OneObject obj = new OneObject(pt, Defines.ImageName.LabelWin, new Size(60, 28));
                    addList.Add(obj);
                }
                else if (f.Winner == yourSide)
                {
                    Point     pt  = new Point(etcPt[6].X + flagPt[i].X, etcPt[6].Y + flagPt[i].Y);
                    OneObject obj = new OneObject(pt, Defines.ImageName.LabelLose, new Size(60, 28));
                    addList.Add(obj);
                }
                else
                {
                    j = 0;
                    foreach (string s in f.GetEffect())
                    {
                        Point     pt  = new Point(effectPt[j].X + flagPt[i].X, effectPt[j].Y + flagPt[i].Y);
                        OneObject obj = new OneObject(pt, s, new Size(32, 16));
                        obj.MouseEnter += new EventHandler(ShowCaption);
                        obj.MouseLeave += new EventHandler(HideCaption);
                        addList.Add(obj);
                        j++;
                    }
                }
            }
            // グレイブヤードのカードを並べる
            i = 0;
            foreach (Card c in gs.GetGraveyard())
            {
                CardObject obj = new CardObject(graveyardPt[i], c, true);
                obj.MouseEnter += new EventHandler(ShowCaption);
                obj.MouseLeave += new EventHandler(HideCaption);
                addList.Add(obj);
                i++;
            }
            //選択されているカード
            if (gs.Turn == mySide && gs.PresentCard != null)
            {
                CardObject obj = new CardObject(etcPt[8], gs.PresentCard, true);
                addList.Add(obj);
            }

            //作成したオブジェクトのうち更新が必要なものだけを追加や削除する
            foreach (ClickableObject obj in pastList)
            {
                ClickableObject t;
                if ((t = GetEqualObj(addList, obj)) != null)
                {
                    addList.Remove(t);
                }
                else
                {
                    deleteList.Add(obj);
                }
            }
            foreach (ClickableObject obj in addList)
            {
                pastList.Add(obj);
                this.Controls.Add(obj);
                obj.BringToFront();
            }
            foreach (ClickableObject obj in deleteList)
            {
                pastList.Remove(obj);
                this.Controls.Remove(obj);
            }
            if (gs.Turn == mySide)
            {
                if (gs.Phase == Defines.Phase.FinishGame)
                {
                    phaseCaption.Text = Defines.CaptionWin + Defines.CaptionPhase[(int)gs.Phase];
                }
                else
                {
                    phaseCaption.Text = "あなたのターンです。  " + Defines.CaptionPhase[(int)gs.Phase];
                }
            }
            else
            {
                if (gs.Phase == Defines.Phase.FinishGame)
                {
                    phaseCaption.Text = Defines.CaptionLose + Defines.CaptionPhase[(int)gs.Phase];
                }
                else
                {
                    phaseCaption.Text = "相手のターンです。";
                }
            }

            labelC.Text = gs.RestCCard.ToString();
            labelT.Text = gs.RestTCard.ToString();
        }