Пример #1
0
 private void SetupRecyclerView(DrinkObject items)
 {
     adapter = new DrinksAdapter(items);
     view    = (RecyclerView)myFragmentView.FindViewById(Resource.Id.drinks_recycler_view);
     manager = new LinearLayoutManager(this.Activity);
     view.SetAdapter(adapter);
     view.SetLayoutManager(manager);
 }
        public void Start()
        {
            int id = PlayerPrefs.GetInt("LastSelected");

            Model.Product drink = CLocalDatabase.GetProductInfo(id);

            DrinkObject drinkObject = CObjectPool.Instance.CreateDrinkObject(drink);

            this.InstantPlacementPrefab          = drinkObject.gameObject;
            this.GameObjectPointPrefab           = drinkObject.gameObject;
            this.GameObjectVerticalPlanePrefab   = drinkObject.gameObject;
            this.GameObjectHorizontalPlanePrefab = drinkObject.gameObject;
        }
Пример #3
0
        private void GetDrinks()
        {
            string endpoint = "https://business.untappd.com/api/v1/sections/{0}/items";

            string[] parameters1 = new string[1];
            string[] parameters2 = new string[1];
            parameters1[0] = on_tap_section_id;
            parameters2[0] = beer_section_id;

            string on_tap_json = MakeCallout(endpoint, parameters1);
            string beer_json   = MakeCallout(endpoint, parameters2);

            Console.WriteLine("ABC:::");
            Console.WriteLine(on_tap_json);
            Console.WriteLine(beer_json);
            try
            {
                DrinkObject on_tap_items = JsonConvert.DeserializeObject <DrinkObject>(on_tap_json);
                DrinkObject beer_items   = JsonConvert.DeserializeObject <DrinkObject>(beer_json);

                Console.WriteLine("LETS SEE...");
                Console.WriteLine(on_tap_items.Items == null);
                Console.WriteLine(beer_items.Items == null);

                App.OnTapObj = on_tap_items;
                App.BeerObj  = beer_items;

                Console.WriteLine(on_tap_items.Items);
                Console.WriteLine(beer_items.Items);
            }
            catch (Exception ex)
            {
                App.OnTapObj = null;
                App.BeerObj  = null;
                Console.WriteLine("ERROR! " + ex.Message);
            }
        }
Пример #4
0
        public override void OnStateEnter()
        {
            Context.Context.ScreenClearColor = Color.Black;

            rand = new Random();
            MapGenerator.GenerateMap(30, 1);
            Random rnd = new Random();


            for (int i = 0; i < 100
                 ; i++)
            {
                VisitorAgent go = new VisitorAgent(new Vector2(50, -80), 1);
                go.MaxHealth = 1;
                go.Name      = "test";
                go.MyTexture = TextureManager.TextureDictionary["testSprite"];
                go.Size      = new Vector2(20, 20);
                Game1.AddGameObject(go);
                agent = go;
                bool foundTile = false;

                while (!foundTile)
                {
                    int x = rnd.Next(1, 39); // creates a number between 1 and 12
                    int y = rnd.Next(1, 39);
                    go.CurrentTile = MapGenerator.Map[x, y];
                    foundTile      = go.CurrentTile.Walkable;
                }
                go.Position = go.CurrentTile.Position;

                //AIActionMoveTo action = new AIActionMoveTo();
                //  action.Target = MapGenerator.Map[x, y];
                // action.MyAgent = go;
                go.Home = go.CurrentTile;
                //  action.SetTarget(MapGenerator.Map[10,10], go);
                // go.JobQueue.Add(action);
                if (i < 100)
                {
                    go.Team = 1;
                }
                else
                {
                    go.Team      = 2;
                    go.MyTexture = TextureManager.TextureDictionary["trump"];
                }
            }

            DrinkObject drink = new DrinkObject();

            drink.MyTexture = TextureManager.TextureDictionary["drinkstand"];

            drink.CurrentTile = MapGenerator.Map[10, 10];
            drink.Position    = new Vector2(500, 500);
            Game1.AddGameObject(drink);



            drink           = new DrinkObject();
            drink.MyTexture = TextureManager.TextureDictionary["drinkstand"];

            drink.CurrentTile = MapGenerator.Map[30, 30];
            drink.Position    = new Vector2(1500, 1500);
            Game1.AddGameObject(drink);



            EatableObject eat = new EatableObject();

            eat.MyTexture = TextureManager.TextureDictionary["burgerstand"];

            eat.CurrentTile = MapGenerator.Map[20, 20];
            eat.Position    = new Vector2(1000, 1000);
            Game1.AddGameObject(eat);



            eat           = new EatableObject();
            eat.MyTexture = TextureManager.TextureDictionary["burgerstand"];

            eat.CurrentTile = MapGenerator.Map[15, 15];
            eat.Position    = new Vector2(750, 750);
            Game1.AddGameObject(eat);


            Tile t = MapGenerator.GetTileAtPosition(new Vector2(0, 0));

            t = MapGenerator.GetTileAtPosition(new Vector2(120, 60));
            t = MapGenerator.GetTileAtPosition(new Vector2(320, 418));



            ToiletObject to = new ToiletObject();

            to.MyTexture = TextureManager.TextureDictionary["toilet"];

            to.CurrentTile = MapGenerator.Map[15, 25];
            to.Position    = new Vector2(750, 1250);
            Game1.AddGameObject(to);



            Bin bin = new Bin();

            bin.CurrentTile = MapGenerator.Map[12, 12];
            bin.Position    = new Vector2(600, 600);
            Game1.AddGameObject(bin);



            JanitorAgent j = new JanitorAgent(new Vector2(50, -80), 1);

            j.MaxHealth = 1;
            j.Name      = "test";
            j.MyTexture = TextureManager.TextureDictionary["trump"];
            j.Size      = new Vector2(20, 20);
            Game1.AddGameObject(j);
            bool found = false;

            while (!found)
            {
                int x = rnd.Next(1, 39); // creates a number between 1 and 12
                int y = rnd.Next(1, 39);
                j.CurrentTile = MapGenerator.Map[x, y];
                found         = j.CurrentTile.Walkable;
            }
            j.Position = j.CurrentTile.Position;

            //AIActionMoveTo action = new AIActionMoveTo();
            //  action.Target = MapGenerator.Map[x, y];
            // action.MyAgent = go;
            j.Home = j.CurrentTile;



            JanitorAgent j2 = new JanitorAgent(new Vector2(50, -80), 1);

            j2.MaxHealth = 1;
            j2.Name      = "test";
            j2.MyTexture = TextureManager.TextureDictionary["trump"];
            j2.Size      = new Vector2(20, 20);
            Game1.AddGameObject(j2);
            bool found3 = false;

            while (!found3)
            {
                int x = rnd.Next(1, 39); // creates a number between 1 and 12
                int y = rnd.Next(1, 39);
                j2.CurrentTile = MapGenerator.Map[x, y];
                found3         = j2.CurrentTile.Walkable;
            }
            j2.Position = j2.CurrentTile.Position;

            //AIActionMoveTo action = new AIActionMoveTo();
            //  action.Target = MapGenerator.Map[x, y];
            // action.MyAgent = go;
            j2.Home = j2.CurrentTile;
        }
Пример #5
0
 public DrinksAdapter(DrinkObject items)
 {
     this.items = items;
 }
Пример #6
0
 public override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     onTapItems = App.OnTapObj;
     beerItems  = App.BeerObj;
 }