Example #1
0
        public void DrawCard(Card card, CCPoint point)
        {
            CCPoint p = fromLocation(point);

            m_LastCard          = TexturePool.GetSprite(card.m_Hash);
            m_LastCard.Position = p;
            m_LastCard.Rotation = card.GetRotation();
            AddChild(m_LastCard);
        }
Example #2
0
        private void checkarray(int w)
        {
            string Font = "Coalition", SubFont = "MarkerFelt";
            int    FontSize = 36, SubFontSize = 22;

            deletelabels();
            labels.Clear();
            plaatjes.Clear();

            switch (PageCounter)
            {
            case 1:
                CCLabel Welcome = new CCLabel("Welkom bij Spacesonne", Font, FontSize, CCLabelFormat.SpriteFont);
                Welcome.Position = new CCPoint(bounds.Center.X, 700);
                labels.Add(Welcome);
                for (int i = 0; i < uitlegdeel1.Length; i++)
                {
                    CCLabel cclabel = new CCLabel(uitlegdeel1[i], SubFont, SubFontSize, CCLabelFormat.SpriteFont);
                    cclabel.Position = new CCPoint(bounds.Center.X, (600 - (i * 60)));
                    labels.Add(cclabel);
                }
                break;

            case 2:
                CCLabel components = new CCLabel("Components", Font, FontSize, CCLabelFormat.SpriteFont);
                components.Position = new CCPoint(bounds.Center.X, 700);
                //CCSprite Sateliette =  TexturePool.GetSprite("10003");
                // Sateliette.Position = new CCPoint();
                labels.Add(components);
                for (int i = 0; i < uitlegdeel2.Length; i++)
                {
                    CCLabel cclabel = new CCLabel(uitlegdeel2[i], SubFont, SubFontSize, CCLabelFormat.SpriteFont);
                    cclabel.Position = new CCPoint(bounds.MidX, (600 - (i * 100)));
                    labels.Add(cclabel);
                }
                break;

            case 3:
                CCLabel Goaltitle = new CCLabel("The goal of the game", Font, FontSize, CCLabelFormat.SpriteFont);
                Goaltitle.Position = new CCPoint(bounds.Center.X, 700);
                labels.Add(Goaltitle);
                for (int i = 0; i < uitlegdeel3.Length; i++)
                {
                    CCLabel cclabel = new CCLabel(uitlegdeel3[i], SubFont, SubFontSize, CCLabelFormat.SpriteFont);
                    cclabel.Position = new CCPoint((bounds.MidX), (600 - (i * 33)));
                    labels.Add(cclabel);
                }
                break;

            case 4:
                CCLabel whatturn = new CCLabel("What can I do on my turn", Font, FontSize, CCLabelFormat.SpriteFont);
                whatturn.Position = new CCPoint(bounds.Center.X, 700);
                labels.Add(whatturn);
                for (int i = 0; i < uitlegdeel4.Length; i++)
                {
                    CCLabel cclabel = new CCLabel(uitlegdeel4[i], SubFont, SubFontSize, CCLabelFormat.SpriteFont);
                    cclabel.Position = new CCPoint(600, (550 - (i * 100)));
                    labels.Add(cclabel);
                }
                break;

            case 5:
                CCLabel FinishedRoad = new CCLabel("How to finish a road?", Font, FontSize, CCLabelFormat.SpriteFont);
                FinishedRoad.Position = new CCPoint(bounds.Center.X, 700);
                labels.Add(FinishedRoad);
                CCSprite Road1 = TexturePool.GetSprite("21111");
                Road1.Rotation = -90; Road1.Position = new CCPoint(850, 400); plaatjes.Add(Road1);
                CCSprite Road2 = TexturePool.GetSprite("20202");
                Road2.Rotation = 90; Road2.Position = new CCPoint(950, 400);  plaatjes.Add(Road2);
                CCSprite Road3 = TexturePool.GetSprite("02220");
                Road3.Position = new CCPoint(1050, 400); plaatjes.Add(Road3);

                for (int i = 0; i < uitlegdeel5.Length; i++)
                {
                    CCLabel cclabel = new CCLabel(uitlegdeel5[i], SubFont, SubFontSize, CCLabelFormat.SpriteFont);
                    cclabel.Position = new CCPoint((bounds.MidX), (600 - (i * 350)));
                    labels.Add(cclabel);
                }
                break;

            case 6:
                CCLabel FinishedSpacestation = new CCLabel("How to finish a spacestation?", Font, FontSize, CCLabelFormat.SpriteFont);
                FinishedSpacestation.Position = new CCPoint(bounds.Center.X, 700);
                labels.Add(FinishedSpacestation);
                CCSprite SpaceStation1 = TexturePool.GetSprite("21202");
                SpaceStation1.Rotation = 180; SpaceStation1.Position = new CCPoint(850, 350); plaatjes.Add(SpaceStation1);
                CCSprite SpaceStation2 = TexturePool.GetSprite("10101");
                SpaceStation2.Rotation = 90; SpaceStation2.Position = new CCPoint(950, 350); plaatjes.Add(SpaceStation2);
                CCSprite SpaceStation3 = TexturePool.GetSprite("01000");
                SpaceStation3.Position = new CCPoint(1050, 350); plaatjes.Add(SpaceStation3);
                for (int i = 0; i < uitlegdeel6.Length; i++)
                {
                    CCLabel cclabel = new CCLabel(uitlegdeel6[i], SubFont, SubFontSize, CCLabelFormat.SpriteFont);
                    cclabel.Position = new CCPoint((bounds.MidX), (600 - (i * 33)));
                    labels.Add(cclabel);
                }
                break;

            case 7:
                CCLabel FinishedSatalite = new CCLabel("How to finish a satelite?", Font, FontSize, CCLabelFormat.SpriteFont);
                FinishedSatalite.Position = new CCPoint(bounds.Center.X, 700);
                CCSprite Finished = new CCSprite("Finished sateliette");
                Finished.Position = new CCPoint(900, 300);
                plaatjes.Add(Finished);
                labels.Add(FinishedSatalite);
                for (int i = 0; i < uitlegdeel7.Length; i++)
                {
                    CCLabel cclabel = new CCLabel(uitlegdeel7[i], SubFont, SubFontSize, CCLabelFormat.SpriteFont);
                    cclabel.Position = new CCPoint((bounds.MidX), (600 - (i * 33)));
                    labels.Add(cclabel);
                }
                break;

            case 8:
                CCLabel FinishedGame = new CCLabel("When is the game finished?", Font, FontSize, CCLabelFormat.SpriteFont);
                FinishedGame.Position = new CCPoint(bounds.Center.X, 700);
                labels.Add(FinishedGame);
                for (int i = 0; i < uitlegdeel8.Length; i++)
                {
                    CCLabel cclabel = new CCLabel(uitlegdeel8[i], SubFont, SubFontSize, CCLabelFormat.SpriteFont);
                    cclabel.Position = new CCPoint((bounds.MidX), (600 - (i * 33)));
                    labels.Add(cclabel);
                }

                CCLabel EndofHalp = new CCLabel("You are ready to play the game now.\nGood luck but most of all have fun!", Font, FontSize, CCLabelFormat.SpriteFont);
                EndofHalp.Position = new CCPoint(bounds.Center.X, 300);
                labels.Add(EndofHalp);
                break;

            default:
                MainActivity.SwitchToMenu(SceneIds.OpeningMenu, 0);
                break;
            }
            paintlabels();
        }
Example #3
0
        public void UpdateInterface(List <Player> playerlist, int amountoftiles, Card tile) // in this method the labels and button are made that need to update everytime a player has his turn
        {
            string    currentplayer = "error";
            string    currentpoints = "error";
            string    currentaliens = "error";
            int       t;
            int       gotvet       = 0;
            CCColor3B currentcolor = CCColor3B.White;
            CCColor3B label_color  = CCColor3B.White;

            foreach (CCLabel l in m_labels)
            {
                RemoveChild(l);
            }
            m_labels.Clear();

            foreach (CCSprite s in m_sprites)
            {
                RemoveChild(s);
            }
            m_sprites.Clear();

            for (t = 0; t < playerlist.Count; t++) //for loop for creating the values for the currentplayer
            {
                if (playerlist[t].Turn == true)
                {
                    currentplayer = playerlist[t].Name;
                    currentpoints = playerlist[t].Points.ToString();
                    currentaliens = playerlist[t].NumberOfAliens.ToString();
                    currentcolor  = playerlist[t].PlayerColor;
                    break;
                }
            }

            MakeLabel(currentplayer, m_font, 36, 260, 140, currentcolor);
            MakeLabel(currentpoints, m_font, 36, 730, 100, label_color);
            MakeLabel(currentaliens, m_font, 36, 950, 100, label_color);
            MakeLabel(amountoftiles.ToString() + "X", m_font, 36, 1810, 245, label_color);

            for (int z = 0; z < (playerlist.Count - 1); z++) //for loop which makes the players on the right who are next in line
            {
                if (t + 1 == playerlist.Count)
                {
                    t = -1;
                }
                MakeLabel(playerlist[t + 1].Name, m_font, 20, 1820, 1050 - gotvet * 100, playerlist[t + 1].PlayerColor);
                MakeLabel(playerlist[t + 1].Points.ToString(), m_font, 20, 1800, 1000 - gotvet * 100, playerlist[t + 1].PlayerColor);
                MakeLabel(playerlist[t + 1].NumberOfAliens.ToString(), m_font, 20, 1890, 1000 - gotvet * 100, playerlist[t + 1].PlayerColor);

                CCSprite smallalien = new CCSprite("alien");
                CCSprite smallcoin  = new CCSprite("coin");
                smallalien.Scale    = 0.25f;
                smallcoin.Scale     = 0.25f;
                smallalien.Position = new CCPoint(1850, 1000 - gotvet * 100);
                smallcoin.Position  = new CCPoint(1750, 1000 - gotvet * 100);
                AddChild(smallalien);
                AddChild(smallcoin);
                m_sprites.Add(smallalien);
                m_sprites.Add(smallcoin);

                gotvet++;
                t++;
            }
            RemoveChild(m_CardButton);
            m_CardButton          = TexturePool.GetSprite(tile.m_Hash);
            m_CardButton.Position = m_CardPos;
            m_CardButton.Rotation = tile.GetRotation();

            AddChild(m_CardButton);
        }
Example #4
0
        void OnTouchesMoved(List <CCTouch> touches, CCEvent touchEvent)
        {
            if (touches.Count <= 0)
            {
                return;
            }

            float x = touches[0].LocationOnScreen.X;
            float y = touches[0].LocationOnScreen.Y;

            if (m_IsCardDragging)
            {
                CCSprite Spr = TexturePool.GetSprite(m_Game.m_CurrentCard.m_Hash);
                Spr.Position = touches[0].LocationOnScreen;

                foreach (CCTouch i in touches)
                {
                    CCPoint p = i.LocationOnScreen;
                    p = m_Overlay.ScreenToWorldspace(p);
                    m_Overlay.m_CardButton.Position = p;
                }
            }
            else
            {
                if (m_Touches == 1) // Pan
                {
                    foreach (CCTouch i in touches)
                    {
                        var s = m_BoardLayer.Camera.CenterInWorldspace;
                        s.X += i.PreviousLocationOnScreen.X - i.LocationOnScreen.X;
                        s.Y += i.LocationOnScreen.Y - i.PreviousLocationOnScreen.Y;
                        m_BoardLayer.Camera.CenterInWorldspace = s;

                        var target = m_BoardLayer.Camera.TargetInWorldspace;
                        target.X = s.X;
                        target.Y = s.Y;
                        m_BoardLayer.Camera.TargetInWorldspace = target;
                    }
                }
                else if (m_Touches == 2) // Zoom
                {
                    if (touches.Count < 2)
                    {
                        return;
                    }

                    for (int i = 0; i < touches.Count; i += 2)
                    {
                        CCPoint fir   = touches[i].LocationOnScreen;
                        CCPoint sec   = touches[i + 1].LocationOnScreen;
                        CCPoint third = touches[i].PreviousLocationOnScreen;
                        CCPoint four  = touches[i + 1].PreviousLocationOnScreen;

                        float one = CCPoint.Distance(fir, sec);
                        float two = CCPoint.Distance(third, four);

                        if (one < two)
                        {
                            m_BoardLayer.UpdateScale(-0.05f);
                        }
                        else
                        {
                            m_BoardLayer.UpdateScale(0.05f);
                        }
                    }
                }
            }
        }