//
    // The only job for this system is to start the game
    //
    private void Start()
    {
        //
        // Initialize the card deck
        // (Trigger InitCardDeckEvent and give number of deck=0)
        //
        //EventManager.TriggerEvent("InitCardDeckEvent", "0");
        //
        CardDeckManager.DeckLocation       = deckOfCards;   //where to stack the deck
        CardDeckManager.CurrentDeckNumber  = 0;             //only one deck is allowed (default)
        CardDeckManager.CurrentCardBack    = 8;             //red
        CardDeckManager.DeckFanOutDistance = 0.03f;         //fan out value to right for deck

        CardDeckManager.CreateDeckOfCards();
        //
        // Find where the stacks are by reading an XML file into a datatable
        //
        //CardStacks cs = new CardStacks();
        // cs.FilePath = new StringReader(StacksLayout.text);

        CardStacks cs = new CardStacks(new StringReader(StacksLayout.text));
        //string temp = Application.streamingAssetsPath;
        //cs.FilePath = temp.Replace("StreamingAssets", "Resources/" + StacksLayout.name + ".xml");

        //cs.Init();

        //StackCollection ic = StackCollection.Load("StacksDB");
        //foreach (StackItems item in ic.stacks)
        //{
        //    print(item.name);

        //}
    }
Esempio n. 2
0
        public override void Play()
        {
            Global.CurrentScene       = this;
            Global.DebugRenderEnabled = false;

            dispY = (int)Global.WindowCenter.Y - 100;
            dispX = 40;
            //znznznznznznznznznznznznznznznznznznznznznznznznznznznznzn
            // Hand cursor mouse + boxcollider
            //znznznznznznznznznznznznznznznznznznznznznznznznznznznznzn
            tmpEnt      = this.CreateGameEntity(Vector2.Zero);
            tmpEnt.Name = "cursor";

            textureImage    = Raylib.LoadTexture("Assets/Img/hand.png");
            Spr             = new Sprite(textureImage);
            Spr.RenderLayer = Global.CURSOR_LAYER;              //on top of everything
            tmpEnt.Add(Spr);
            BoxCollider bxxx = new BoxCollider(12, 12);

            tmpEnt.Add(bxxx);
            tmpEnt.Add <MouseComponent>();
            //znznznznznznznznznznznznznznznznznznznznznznznznznznznznzn
            // Game status (Score + Game over)
            //znznznznznznznznznznznznznznznznznznznznznznznznznznznznzn
            GameStatus      = this.CreateGameEntity(new Vector2(5, 10));
            GameStatus.Name = "Game Status";
            Text scoreTxt = new Text("Score: ", TextFontTypes.Arial);

            GameStatus.Add(scoreTxt);
            MsgBox mb = new MsgBox(Global.WindowCenter - new Vector2(150, 0), 350, 150, Color.BROWN);

            mb.Visiable = false;
            GameStatus.Add(mb);
            GameStatus.Add <GameStatComponent>();

            //znznznznznznznznznznznznznznznznznznznznznznznznznznznznzn
            // Create a deck of cards
            //znznznznznznznznznznznznznznznznznznznznznznznznznznznznzn
            CardDeck = new CardDeckManager(this);
            CardDeck.CardsHaveCollider = false;
            CardDeck.CreateDeckOfCards(false);

            CreateDealPile();                           // deal stack (falce down)
            CreateDrawPile();                           // face up dealt one card at a time
            CreateEmptyAcePiles();                      // 4 of them
            CreateEmptyPlayPiles();                     // 7 of them
            CreateEmptyDragPile();                      // used to disp cards being dragged around
            DealCardsToPiles();                         // draw cards & place in piles above
            //
            // Play Button
            //
            Global.StateOfGame = GameState.Over;
            PlayBtn            = CreateSceneEntity(new Vector2(850, 50));
            PlayBtn.Name       = "playBtn";
            position           = PlayBtn.Get <Transform>().Position;
            Button bt = new Button(position, 75, 30, "Play", -6, 2);

            PlayBtn.Add(bt);
            bt.Click += PlayButton;
            //
            // End Button
            //
            Global.StateOfGame = GameState.Over;
            entUI      = CreateSceneEntity(new Vector2(850, 100));
            entUI.Name = "playBtn";
            position   = entUI.Get <Transform>().Position;
            bt         = new Button(position, 75, 30, "End", -6, 2);
            entUI.Add(bt);
            bt.Click += EndButton;

            //znznznznznznznznznznznznznzn
            //   Scene Starts Playing
            //znznznznznznznznznznznznznzn
        }