예제 #1
2
 // Use this for initialization
 void Start()
 {
     S = this;
     rb = GetComponent<Rigidbody>();
     rb.AddForce(Vector3.forward * 20);
     rb.AddForce(Vector3.up * 10);
     mouseXPos = 0;
 }
        protected override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
           
            SetContentView(Resource.Layout.activity_detail);

            friends = Util.GenerateFriends();
            imageLoader = ImageLoader.Instance;

            var toolbar = FindViewById<V7Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            if (monkey == null)
            { 
                var t = Intent.GetStringExtra("Name");
                monkey = friends.First(m => m.Name == t);
            }

            ShowMonkey();


            client = new GoogleApiClient.Builder(this).AddApi(AppIndex.API).Build();
            url = $"http://monkeysapp.com/Home/Detail/{monkey.Name.Replace(" ", "%20")}";
            title = monkey.Name;
            description = monkey.Details;
            schemaType = "http://schema.org/Article";
        }
예제 #3
0
    public DetailsPage(Monkey monkey)
    {
      this.Title = monkey.Name;

      var details = new Label{
        Text = monkey.Details
      };

      var image = new Image
      {
        Source = monkey.Image,
        Aspect = Aspect.AspectFit,
        VerticalOptions = LayoutOptions.FillAndExpand
      };

      Content = new ScrollView
      {
        Padding = 20,
        Content = new StackLayout
        {
          Spacing = 10,
          VerticalOptions = LayoutOptions.FillAndExpand,
          Children = { details, image}
        }
      };
    }
예제 #4
0
 public PlayerPanel(Monkey player)
     : base(VersusScreen.Instance.Game)
 {
     this.GameHM = VersusScreen.Instance;
     this.Player = player;
     this.Position = Vector2.Zero;
     VersusScreen.Instance.Components.Add(this);
 }
예제 #5
0
파일: TestDerive.cs 프로젝트: dsedb/LANgame
	IEnumerator Start()
	{
		var list = new Mammal[5];
		for (var i = 0; i < list.Length; ++i) {
			if (Random.Range(0, 2) == 0) {
				list[i] = new Monkey();
			} else {
				list[i] = new Human();
			}
		}
		yield return null;

		foreach (var mammal in list) {
			mammal.func();
		}
		yield return null;
	}
예제 #6
0
 void OnListViewItemSelected(object sender, SelectedItemChangedEventArgs e)
 {
     Monkey selectedItem = e.SelectedItem as Monkey;
 }
 public ContactController()
 {
     _monkey = new Monkey();
 }
 public MonkeyView (Context context, IAttributeSet attrs, Monkey monkey) :
     base (context, attrs)
 {
     Monkey = monkey;
     Initialize ();
 }
예제 #9
0
        private void CreateMonkey_Click(object sender, EventArgs e)
        {
            amountofmonkeys += 1;
            listBox.Items.Add(Convert.ToString(Monkey.Name()) + Convert.ToString(amountofmonkeys) + " Energy:" + (Convert.ToString(Monkey.Energy())));

            if (createTable == true)
            {
                dtbl.Columns.Add("Animal");
                dtbl.Columns.Add("Energy");
                dataGridView.DataSource = dtbl;
                dtbl.Rows.Add(Convert.ToString(Monkey.Name()) + Convert.ToString(amountofmonkeys), Monkey.Energy());
                createTable = false;
            }
            else
            {
                dataGridView.DataSource = dtbl;
                dtbl.Rows.Add(Convert.ToString(Monkey.Name()) + Convert.ToString(amountofmonkeys), Monkey.Energy());
            }
        }
 public MonkeyDetailsViewModel(Monkey monkey)
     : this()
 {
     Monkey = monkey;
     Title  = $"{Monkey.Name} Details";
 }
예제 #11
0
        public override void LoadContent()
        {
            loading.Enter();

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            resolvedBackbuffer = new ResolveTexture2D(GraphicsDevice,
                1280, 720,
                1, GraphicsDevice.DisplayMode.Format);

            twitchNoise = Content.Load<Texture2D>("Textures/Helpers/twitch_noise");
            twitchEffect = Content.Load<Effect>("Effects/twitch");
            twitchRenderTarget = new RenderTarget2D(GraphicsDevice, 128, 128, 1, GraphicsDevice.DisplayMode.Format, RenderTargetUsage.PreserveContents);

            WalkingSound = Content.Load<SoundEffect>("Sounds/footsteps");
            NoiseSound = Content.Load<SoundEffect>("Sounds/noise0").CreateInstance();
            NoiseSound.IsLooped = true;
            GameOverMusic = Content.Load<Song>("Music/gameover");

            for (int i = 0; i < Themes.Length; i++)
            {
                String type = (i == 0 ? "good" : "evil");

                Themes[i] = new Theme
                {
                    Background = Content.Load<Texture2D>("Textures/Backgrounds/" + type),
                    Parallax = {
                        Content.Load<Texture2D>("Textures/Backgrounds/stars1"),
                        Content.Load<Texture2D>("Textures/Backgrounds/stars2"),
                        Content.Load<Texture2D>("Textures/Backgrounds/stars3")
                    },
                    MonkeyM = new SpriteAnimationSwitcher("monkey_m", new String[] { "left", "right", "crash", "penalty", "stomp" }),
                    MonkeyF = new SpriteAnimationSwitcher("monkey_f", new String[] { "left", "right", "crash", "penalty", "stomp" }),
                    Panel = new SpriteAnimationSwitcher("score_" + type, new String[] { "score_000", "score_001", "score_002", "score_003", "score_004", "score_005" }),
                    Coconut = new SpriteAnimationSwitcher(type, new String[] { "coconut", "explosion" }),
                    Planet = new SpriteAnimationSwitcher(type, new String[] { "planet", "highlightandshadow" }),
                    Tree = new SpriteAnimationSwitcher("palme_" + type, new String[] { "palme" }),
                    SunTutorial = new SpriteAnimationSwitcher("SunTutorial", new String[] { "sun" }),
                    TutorialColor = (i == 0) ? Color.White : Color.Red,
                    BackgroundMusic = Content.Load<Song>("Music/space"),
                    SoundCreateCoconut = Content.Load<SoundEffect>(i == 0 ? "Sounds/plop" : "Sounds/missile"),
                    SoundJump = Content.Load<SoundEffect>("Sounds/jump"),
                    SoundStomp = Content.Load<SoundEffect>("Sounds/stomp"),
                    SoundExplode = Content.Load<SoundEffect>(i == 0 ? "Sounds/heart" : "Sounds/explosion"),
                    SoundMissile = Content.Load<SoundEffect>(i == 0 ? "Sounds/plop" : "Sounds/missile"),
                    SoundCollide = Content.Load<SoundEffect>("Sounds/collide_" + type),
                    //SoundMonkeyHit = Content.Load<SoundEffect>("Sounds/monkey"),
                    SoundMonkeyHit = Content.Load<SoundEffect>("Sounds/monkey_" + type),
                    //Beleuchtung = new SpriteAnimationSwitcher("beleuchtung_" + type, new String[] { "beleuchtung" }),
                };

                if (i == 1)
                {
                    Themes[i].Parallax.Insert(2, Content.Load<Texture2D>("Textures/Backgrounds/skull"));
                }
            }
            GameOverSprites = new SpriteAnimationSwitcher("game_over", new String[] { "game_over_m", "game_over_f" });
            CurrentTheme = Themes[0];

            MediaPlayer.Volume = bgMusicVolume;

            Planet prop1 = new Planet(PlayerIndex.One);
            prop1.Position = new Vector2(200, 350);
            Monkey monkey1 = new Monkey(prop1);
            Planets.Add(prop1);

            Planet prop2 = new Planet(PlayerIndex.Two);
            prop2.Position = new Vector2(1000, 350);
            Monkey monkey2 = new Monkey(prop2);
            Planets.Add(prop2);

            PlayerPanel1 = new PlayerPanel(monkey1);
            PlayerPanel2 = new PlayerPanel(monkey2);

            float panelY = 650f;
            float panelX = 120f;
            PlayerPanel1.Position = new Vector2(panelX, panelY);
            PlayerPanel2.Position = new Vector2(GraphicsDevice.Viewport.Width - PlayerPanel.Offset.X - panelX, panelY);

            SunlightDir = new Vector2(0.0f, -1.0f);
            Camera = new DriftingCamera();

            GameState = GameStates.Game;

            loading.Exit();
        }
 void Expand(Monkey monkey)
 {
     Message = $"{monkey.Name} tapped.";
     OnPropertyChanged("Message");
 }
 public DetailsViewModel(Monkey monkey)
 {
     Monkey = monkey;
 }
 public DetailsPage(Monkey monkey)
 {
   InitializeComponent();
   this.BindingContext = monkey;
 }
예제 #15
0
 public MonkeyView (Context context, IAttributeSet attrs, int defStyle, Monkey monkey) :
     base (context, attrs, defStyle)
 {
     Monkey = monkey;
     Initialize ();
 }
예제 #16
0
        protected override void OnMounted()
        {
            State.Monkeys = Monkey.GetList();

            base.OnMounted();
        }
예제 #17
0
 public IdleState(Monkey _actor)
 {
     actor        = _actor;
     durationTime = 2.0f;
 }
예제 #18
0
 public StateMachine(Monkey apa)
 {
     this.actor   = apa;
     currentState = null;
 }
예제 #19
0
 public MonkeyBuilder()
 {
     aAnimal = new Monkey();
 }
 public DetailsPage(Monkey monkey)
 {
     InitializeComponent();
     BindingContext = new MonkeyDetailsViewModel(monkey);
 }
예제 #21
0
        public void HasCorrectHP1()
        {
            Monkey animal = new Monkey();

            Assert.Equal(12, animal.HP);
        }
예제 #22
0
 private Warrior[] GetWarriors(string[] warriorCharacters)
 {
     Warrior[] warriors = new Warrior[warriorCharacters.Length];
     for (int i = 0; i < warriorCharacters.Length; i++)
     {
         switch (warriorCharacters[i])
         {
             case "t":
                 warriors[i] = new Turtle(i);
                 break;
             case "m":
                 warriors[i] = new Monkey(i);
                 break;
             default:
                 warriors[i] = new Pigeon(i);
                 break;
         }
     }
     return warriors;
 }
예제 #23
0
        IEnumerable <Monkey> GetMonkeys()
        {
            if (!VerifyStore())
            {
                RestartAuthFlow();
                return(null);
            }

            Log("GetMonkeys", "Getting monkies...");
            var table        = DropboxDatastore.GetTable("monkeys");
            var values       = new List <Monkey>(6);
            var queryResults = table.Query();

            var results = queryResults.ToEnumerable <DBRecord>().Where(r => !r.IsDeleted).ToList();

            // If we have more records than we should,
            // just start fresh.
            if (results.Count > 6)
            {
                foreach (var record in results)
                {
                    record.DeleteRecord();
                }
            }
            if (results.Count == 0)
            {
                // Generate random monkeys.
                values.AddRange(Monkey.GetAllMonkeys());
                Records = new Dictionary <string, DBRecord>();
            }
            else
            {
                Records = results.ToDictionary(x => x.GetString("Name"), x => x);

                // Process existing monkeys.
                foreach (var row in results)
                {
                    // Remove any MonkeyBox app data that's still in the old format.
                    var currentRow = row;
                    if (row.FieldNames().All(r => currentRow.GetFieldType(r).ToString() == "STRING"))
                    {
                        row.DeleteRecord();
                        continue;
                    }

                    values.Add(new Monkey {
                        Name     = row.GetString("Name"),
                        Scale    = Convert.ToSingle(row.GetDouble("Scale")),
                        Rotation = Convert.ToSingle(row.GetDouble("Rotation")),
                        X        = Convert.ToSingle(row.GetDouble("X")),
                        Y        = Convert.ToSingle(row.GetDouble("Y")),
                        Z        = Convert.ToInt32(row.GetLong("Z"))
                    });
                }

                // Create new MonkeyBox app data if we just removed old data.
                if (values.Count == 0)
                {
                    // Generate random monkeys.
                    values.AddRange(Monkey.GetAllMonkeys());
                    foreach (var val in values)
                    {
                        var record = table.GetOrInsert(val.Name, val.ToFields());
                        Records[val.Name] = record;
                    }
                    DropboxDatastore.Sync();
                }
            }

            return(values);
        }
예제 #24
0
        private void FeedMonkeys_Click(object sender, EventArgs e)
        {
            int i = 0;

            while (i < listBox.Items.Count)
            {
                string storage = Convert.ToString(listBox.Items[i]);
                if (storage.Contains(Convert.ToString(Monkey.Name())))
                {
                    string animaltext = Convert.ToString(listBox.Items[i]);
                    string animalnumbercutofbefore = animaltext.Split(new[] { Convert.ToString(Monkey.Name()) }, StringSplitOptions.None).Last();
                    string animalnumber            = animalnumbercutofbefore.Split(new[] { " " }, StringSplitOptions.None).First();
                    string animalenergy            = animaltext.Split(new[] { "Energy:" }, StringSplitOptions.None).Last();
                    int    energyinnumbers         = Convert.ToInt32(animalenergy);
                    string feededenergy            = Convert.ToString(energyinnumbers + Monkey.Eat());
                    listBox.Items.RemoveAt(i);
                    listBox.Items.Insert(i, Convert.ToString(Monkey.Name() + animalnumber + " Energy:" + feededenergy));
                    dtbl.Rows[i][0] = (Convert.ToString(Monkey.Name()) + animalnumber);
                    dtbl.Rows[i][1] = feededenergy;
                    i++;
                }
                else
                {
                    i++;
                }
            }
        }
예제 #25
0
 private void Awake()
 {
     monkeyScript = this;
 }
예제 #26
0
 private void timer_Tick(object sender, EventArgs e)
 {
     if (listBox.Items.Count > 0)
     {
         {
             DerivedClass x = new DerivedClass();
             int          i = 0;
             while (i < listBox.Items.Count)
             {
                 string storage = Convert.ToString(listBox.Items[i]);
                 if (storage.Contains(Convert.ToString(Monkey.Name())))
                 {
                     string animaltext = Convert.ToString(listBox.Items[i]);
                     string animalnumbercutofbefore = animaltext.Split(new[] { Convert.ToString(Monkey.Name()) }, StringSplitOptions.None).Last();
                     string animalnumber            = animalnumbercutofbefore.Split(new[] { " " }, StringSplitOptions.None).First();
                     string animalenergy            = animaltext.Split(new[] { "Energy:" }, StringSplitOptions.None).Last();
                     int    energyinnumbers         = Convert.ToInt32(animalenergy);
                     string feededenergy            = Convert.ToString(energyinnumbers - (x.monkeyEnergy));
                     if (feededenergy != "0")
                     {
                         listBox.Items.RemoveAt(i);
                         listBox.Items.Insert(i, Convert.ToString(Monkey.Name() + animalnumber + " Energy:" + feededenergy));
                         dtbl.Rows[i][0] = (Convert.ToString(Monkey.Name()) + animalnumber);
                         dtbl.Rows[i][1] = feededenergy;
                         i++;
                     }
                     else
                     {
                         listBox.Items.RemoveAt(i);
                         dtbl.Rows.RemoveAt(i);
                     }
                 }
                 else
                 if (storage.Contains(Convert.ToString(LionNonlead.Name())))
                 {
                     string animaltext = Convert.ToString(listBox.Items[i]);
                     string animalnumbercutofbefore = animaltext.Split(new[] { Convert.ToString(LionNonlead.Name()) }, StringSplitOptions.None).Last();
                     string animalnumber            = animalnumbercutofbefore.Split(new[] { " " }, StringSplitOptions.None).First();
                     string animalenergy            = animaltext.Split(new[] { "Energy:" }, StringSplitOptions.None).Last();
                     int    energyinnumbers         = Convert.ToInt32(animalenergy);
                     string feededenergy            = Convert.ToString(energyinnumbers - (x.lionEnergy));
                     if (feededenergy != "0")
                     {
                         listBox.Items.RemoveAt(i);
                         listBox.Items.Insert(i, Convert.ToString(LionNonlead.Name() + animalnumber + " Energy:" + feededenergy));
                         dtbl.Rows[i][0] = (Convert.ToString(LionNonlead.Name()) + animalnumber);
                         dtbl.Rows[i][1] = feededenergy;
                         i++;
                     }
                     else
                     {
                         listBox.Items.RemoveAt(i);
                         dtbl.Rows.RemoveAt(i);
                     }
                 }
                 else
                 if (storage.Contains(Convert.ToString(Elephant.Name())))
                 {
                     string animaltext = Convert.ToString(listBox.Items[i]);
                     string animalnumbercutofbefore = animaltext.Split(new[] { Convert.ToString(Elephant.Name()) }, StringSplitOptions.None).Last();
                     string animalnumber            = animalnumbercutofbefore.Split(new[] { " " }, StringSplitOptions.None).First();
                     string animalenergy            = animaltext.Split(new[] { "Energy:" }, StringSplitOptions.None).Last();
                     int    energyinnumbers         = Convert.ToInt32(animalenergy);
                     string feededenergy            = Convert.ToString(energyinnumbers - (x.elephantEnergy));
                     if (feededenergy != "0")
                     {
                         listBox.Items.RemoveAt(i);
                         listBox.Items.Insert(i, Convert.ToString(Elephant.Name() + animalnumber + " Energy:" + feededenergy));
                         dtbl.Rows[i][0] = (Convert.ToString(Elephant.Name()) + animalnumber);
                         dtbl.Rows[i][1] = feededenergy;
                         i++;
                     }
                     else
                     {
                         listBox.Items.RemoveAt(i);
                         dtbl.Rows.RemoveAt(i);
                     }
                 }
             }
         }
     }
 }
예제 #27
0
 public MonkeyView (Context context, Monkey monkey) :
     base (context)
 {
     Monkey = monkey;
     Initialize ();
 }
예제 #28
0
    public Residence() : base()
    {
        //Penguin residence
        _penguinBackground = new Sprite("PenguinBackground.png");
        AddChild(_penguinBackground);
        _penguinBackground.visible = false;

        _penguin = new Penguin();
        AddChild(_penguin);
        _penguin.x       = game.width / 2;
        _penguin.y       = 164;
        penguinActive    = false;
        _penguin.visible = false;

        _penguinFence = new Sprite("ArcticFence.png");
        AddChild(_penguinFence);
        _penguinFence.visible = false;
        //

        //Zebra residence
        _zebraBackground = new Sprite("ZebraBackground.png");
        AddChild(_zebraBackground);
        _zebraBackground.visible = false;

        _zebra = new Zebra();
        AddChild(_zebra);
        _zebra.x       = game.width / 2 - 160;
        _zebra.y       = 317;
        zebraActive    = false;
        _zebra.visible = false;
        _zebra.scale   = 1f;

        _zebraFence = new Sprite("JungleFence.png");
        AddChild(_zebraFence);
        _zebraFence.visible = false;
        //

        //Sea lion residence
        _seaLionBackground = new Sprite("SeaLionBackground.png");
        AddChild(_seaLionBackground);
        _seaLionBackground.visible = false;

        _seaLion = new SeaLion();
        AddChild(_seaLion);
        _seaLion.x       = game.width / 2 - 400;
        _seaLion.y       = 250;
        seaLionActive    = false;
        _seaLion.visible = false;
        _seaLion.scale   = 0.5f;
        //

        //Turtle residence
        _turtleBackground = new Sprite("TurtleBackground.png");
        AddChild(_turtleBackground);
        _turtleBackground.visible = false;

        _turtle = new Turtle();
        AddChild(_turtle);
        _turtle.x       = game.width / 2 - 300;
        _turtle.y       = 200;
        turtleActive    = false;
        _turtle.visible = false;
        _turtle.scale   = 0.7f;
        //

        //Monkey residence
        _monkeyBackground = new Sprite("MonkeyBackground.png");
        AddChild(_monkeyBackground);
        _monkeyBackground.visible = false;

        _monkey = new Monkey();
        AddChild(_monkey);
        _monkey.x       = game.width / 2 - 635;
        _monkey.y       = 285;
        monkeyActive    = false;
        _monkey.visible = false;
        _monkey.scale   = 1.1f;

        _monkeyFence = new Sprite("JungleFence.png");
        AddChild(_monkeyFence);
        _monkeyFence.visible = false;
        //

        //Lion residence
        _lionBackground = new Sprite("LionBackground.png");
        AddChild(_lionBackground);
        _lionBackground.visible = false;

        _lion = new Lion();
        AddChild(_lion);
        _lion.x       = game.width / 2 - 50;
        _lion.y       = 50;
        lionActive    = false;
        _lion.visible = false;
        _lion.scale   = 0.8f;
        //

        //Giraffe residence
        _giraffeBackground = new Sprite("GiraffeBackground.png");
        AddChild(_giraffeBackground);
        _giraffeBackground.visible = false;

        _giraffe = new Giraffe();
        AddChild(_giraffe);
        _giraffe.x       = game.width / 2 - 165;
        _giraffe.y       = 155;
        giraffeActive    = false;
        _giraffe.visible = false;

        _giraffeFence = new Sprite("JungleFence.png");
        AddChild(_giraffeFence);
        _giraffeFence.visible = false;

        //Hippo residence
        _hippoBackground = new Sprite("HippoBackground.png");
        AddChild(_hippoBackground);
        _hippoBackground.visible = false;

        _hippo = new Hippo();
        AddChild(_hippo);
        _hippo.x       = game.width / 2 - 350;
        _hippo.y       = 370;
        hippoActive    = false;
        _hippo.visible = false;
        _hippo.scale   = 0.5f;

        _hippoFence = new Sprite("JungleFence.png");
        AddChild(_hippoFence);
        _hippoFence.visible = false;
        //
    }
        public DetailsPage(Monkey monkey)
        {
            InitializeComponent();

        }
예제 #30
0
 public abstract void Handle(Monkey message);
예제 #31
0
 async void ShowDetail(Monkey monkey)
 {
     await _navigation.PushAsync(new DetailsPage(monkey));
 }
예제 #32
0
 public void SetMonkey(Monkey monkey)
 {
     this.monkey = monkey;
 }
예제 #33
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // As we are using a UIImageView, we need to detect taps with a UITapGestureRecognizer
            UITapGestureRecognizer tapGesture = new UITapGestureRecognizer((obj) =>
            {
                if (!gameInProgress)
                {
                    // Reset the score before we start the game
                    score = 0;
                    InvokeOnMainThread(() =>
                    {
                        // Updating the UI, so we need to invoke on the main thread
                        ScoreLabel.Text = "Score: 0";
                    });
                    // Reset the timer
                    time = 5000;
                    // Fire the timer every 100ms (this will provide us with the countdown)
                    gameTimer.Interval = 100;
                    // Start the timer and mark the game as in progress
                    gameTimer.Start();
                    gameInProgress = true;
                }
                else
                {
                    // If the game is already in progress, increase the score
                    score++;
                    InvokeOnMainThread(() =>
                    {
                        ScoreLabel.Text = string.Format("Score: {0}", score);
                    });
                }
            });

            Monkey.AddGestureRecognizer(tapGesture);

            gameTimer.Elapsed += (sender, e) =>
            {
                // This is triggered every 100ms (as previously set up)
                // so we need to deduct 100 from the time remaining
                time = time - 100;
                InvokeOnMainThread(() =>
                {
                    // Update the time label with the time remaining
                    TimerLabel.Text = string.Format("Time: {0:F1}s", (float)time / 1000);
                });

                if (time.Equals(0))
                {
                    // Once we run out of time, stop the timer
                    gameTimer.Stop();
                    gameInProgress = false;
                    InvokeOnMainThread(() =>
                    {
                        ScoreViewController scoreVC = Storyboard.InstantiateViewController("ScoreVC") as ScoreViewController;
                        // Pass the score and ActiveConversation to the next ViewController
                        scoreVC.finalScore   = score;
                        scoreVC.conversation = ActiveConversation;
                        ShowViewController(scoreVC, this);

                        // Reset the labels
                        ScoreLabel.Text = "Tap monkey to begin!";
                        TimerLabel.Text = "Time: 0.0s";
                    });
                }
            };
        }
예제 #34
0
        void OnListViewItemTapped(object sender, ItemTappedEventArgs e)
        {
            Monkey tappedItem = e.Item as Monkey;

            OnNextPageButtonClicked(sender, e);
        }
예제 #35
0
 void OnCurrentItemChanged(object sender, CurrentItemChangedEventArgs e)
 {
     previousItem = e.PreviousItem as Monkey;
     currentItem  = e.CurrentItem as Monkey;
     UpdateLabels();
 }
예제 #36
0
 private void OnQueryList(string query)
 {
     SetState(s => s.Monkeys = Monkey.GetList().Where(monkey => monkey.Name.ToLower().Contains(query.ToLower())).ToList());
 }
예제 #37
0
        protected override void Initialize()
        {
            base.Initialize();

            Device = GraphicsDevice;


            var windowWidth  = 1000;
            var windowHeight = 1000;

            _graphics.PreferredBackBufferWidth  = windowWidth;
            _graphics.PreferredBackBufferHeight = windowHeight;
            _graphics.ApplyChanges();

            _spriteBatch = new SpriteBatch(_graphics.GraphicsDevice);


            var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, windowWidth, windowHeight);

            _camera = new Camera2D(viewportAdapter);
            Camera  = _camera;

            _map = new Map();
            _map.Initialize(Content, _spriteBatch);

            _character = new Character();

            _camera.LookAt(_character.Position);

            _fpsPrinter = new FpsPrinter();

            DefaultFont = Content.Load <SpriteFont>("font/defaultFont");


            KeyboardManager.OnKeyPress(Keys.F2, (key) =>
            {
                var characterSize  = new Vector2(_character.Texture.Width, _character.Texture.Height);
                var monkeyPosition = _character.Position + characterSize + new Vector2(100, -100);
                var monkey         = Monkey.SpawnMonkey(Content, monkeyPosition);
            });

            KeyboardManager.OnKeyPress(Keys.F3, (key) =>
            {
                var armor = new Armor(_character);
                _character.AddItem(armor);
            });

            KeyboardManager.OnKeyPress(Keys.F4, (key) =>
            {
                _character.OnHit();
            });

            var spawnSpots = _map.GetSpawnSpots();

            spawnSpots.ForEach(spawnSpot =>
            {
                var monkey = Monkey.SpawnMonkey(Content, spawnSpot);
            });

            _contactManager = new ContactManager();
            Map.World.SetContactListener(_contactManager);
        }
예제 #38
0
 void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     Monkey selectedItem = e.CurrentSelection[0] as Monkey;
 }
 public MonkeyDetailsViewModel(Monkey monkey)
     : this()
 {
 }
예제 #40
0
 public async Task NavigateToDetails(Monkey monkey)
 {
     await Xamarin.Forms.Application.Current.MainPage.Navigation.PushModalAsync(new Outra());
 }
예제 #41
0
 public MonkeyTests()
 {
     monkeyName = "Singe1";
     monkey     = new Monkey(monkeyName);
     trick      = new Trick("Salto", TrickType.Acrobatie);
 }
예제 #42
0
 public MonkeyBuilder()
 {
     animal = new Monkey();
 }
        //private async Task SelectMonkey()
        //{
        //    // do what ever you want when click the button
        //    await Application.Current.MainPage.DisplayAlert("monkey button", "This is a monkey", "Cancel");
        //}

        private void SelectMonkey(Monkey monkey)
        {
            // do what ever you want when click the button
            Debug.WriteLine(monkey.Name);
        }
예제 #44
0
 private void Awake()
 {
     monkeyScript = this;
 }
예제 #45
0
 public void OnItemSelected(Monkey selectedMonkey)
 {
     SelectedMonkey = selectedMonkey;
     SelectedIndex  = MonkeyList.IndexOf(_selectedMonkey);
 }