Beispiel #1
0
        void Character_Action(object sender, CharEventArgs e)
        {
            List <KeyValuePair <string, int> > bidoni_tilecode = new List <KeyValuePair <string, int> >()
            {
                new KeyValuePair <string, int>("blue", 9765),
                new KeyValuePair <string, int>("grigio", 9764),
                new KeyValuePair <string, int>("giallo", 9846),
                new KeyValuePair <string, int>("marrone", 9762),
                new KeyValuePair <string, int>("rosso", 9766),
                new KeyValuePair <string, int>("verde", 9763),
                new KeyValuePair <string, int>("centro_raccolta", 9761),
                new KeyValuePair <string, int>("vestiti", 9833),
                new KeyValuePair <string, int>("olio", 13510),
                new KeyValuePair <string, int>("toner", 13526),
                new KeyValuePair <string, int>("batterie", 9850)
            };

            if (bidoni_tilecode.Where(kvp => kvp.Value == e.a) != null)
            {
                ban.text      = "Premi space per gettare i rifiuti";
                ban.isVisible = true;
                ConstVar.chooseBucket.window.activeBin = bidoni_tilecode.Where(kvp => kvp.Value == e.a).ToList();
            }
            else
            {
                space_button_action = null;
                ban.isVisible       = false;
            }
        }
Beispiel #2
0
 protected virtual void E_Killed(CharEventArgs e)
 {
     if (OnKilled != null)
     {
         OnKilled(this, e);
     }
 }
Beispiel #3
0
 protected virtual void E_EndTurn(CharEventArgs e)
 {
     if (OnEndTurn != null)
     {
         OnEndTurn(this, e);
     }
 }
Beispiel #4
0
 private void Terminal_ControlCharEntered( object sender, CharEventArgs e )
 {
     if( e.Char == '\t' )
      {
     //m_boo.SuggestCodeCompletion(  )
     //TODO suggest completion
      }
 }
 private void Terminal_ControlCharEntered(object sender, CharEventArgs e)
 {
     if (e.Char == '\t')
     {
         //m_boo.SuggestCodeCompletion(  )
         //TODO suggest completion
     }
 }
Beispiel #6
0
 static void Change_X(Object source, CharEventArgs e)
 {
     if (e.CurrChar == 'x' || e.CurrChar = 'X')
     {
         Console.Write("触发的字符是x,");
         Console.Write("把x替为:");
         e.CurrChar = '?';
     }
Beispiel #7
0
            protected internal override void OnCharEvent(CharEventArgs _event)
            {
                base.OnCharEvent(_event);
                var oldText = Control.Text;

                if (Control.editText.ProcessChar(_event.Character))
                {
                    Control.OnTextChanged(new TextChangedEventArgs(oldText, Control.Text));
                }
            }
Beispiel #8
0
        private void OnCharEntered(object sender, CharEventArgs c)
        {
            if (enabled)
            {
                //Check if the new amount of lines is smaller than maxLines, add the character to the text
                string newText = Font.Wrap(baseText + c.Character, ClickRectangle.Width);
                if (newText.Split(new string[] { "\n" }, StringSplitOptions.None).Length <= maxLines)
                {
                    Text += c.Character;
                }

                //Make the cursor visible
                cursorVisible = true;
                blinkTimeLeft = blinkTime;
            }
        }
Beispiel #9
0
        // Event for when the sysop hits a key locally }
        static void Door_OnSysOpKey(object sender, CharEventArgs e)
        {
            switch (e.Character)
            {
            case '\x2E':     //ALT-C
                Door.TextAttr(7);
                Door.ClrScr();
                Door.WriteLn("The SysOp wants to speak to you!  (Press ESC to leave chat)");
                Door.WriteLn();
                Door.SysopChat();
                RedrawScreen();
                break;

            case '\x23':     //ALT-H
                ChangeMsg("You Are Unworthy (The SysOp Has Disconnected You)");
                System.Threading.Thread.Sleep(2500);
                Door.Disconnect();
                Environment.Exit(0);
                break;

            case '\x25':     //ALT-K
                ChangeMsg("You Are Unworthy (The SysOp Has Kicked You)");
                System.Threading.Thread.Sleep(2500);
                Environment.Exit(0);
                break;

            case '\x3B':     //F1
                if (Status.Current == Status.Count - 1)
                {
                    Status.Current = 0;
                }
                else
                {
                    Status.Current++;
                }
                break;
            }
        }
Beispiel #10
0
        public void update(GameTime gameTime, Background background)
        {
            float elapsed = (float)gameTime.ElapsedGameTime.TotalMilliseconds;

            timerAnimated -= elapsed;
            thinkingBubble.Update(gameTime);
            heartBubble.Update(gameTime);
            esclamativeBubble.Update(gameTime);
            questionBubble.Update(gameTime);
            //speechBubble.Update(gameTime, getPos());

            if (isGamer)
            {
                long[,] activeTile      = (ConstVar.layers.Find(t => Equals(t.name, "active"))).tileMap;
                long[,] bidoni_stradali = (ConstVar.layers.Find(t => Equals(t.name, "bidoni_stradali"))).tileMap;


                long x = (int)getTilePos(background).Y;
                long y = (int)getTilePos(background).X;
                if (activeTile != null)
                {
                    if (activeTile[x, y] != 0)
                    {
                        args   = new CharEventArgs();
                        args.a = Convert.ToInt32(activeTile[(int)getTilePos(background).Y, (int)getTilePos(background).X]);
                        Action?.Invoke(this, args);
                    }
                    else if (bidoni_stradali[x, y] != 0)
                    {
                        args   = new CharEventArgs();
                        args.a = Convert.ToInt32(bidoni_stradali[(int)getTilePos(background).Y, (int)getTilePos(background).X]);
                        Action?.Invoke(this, args);
                    }
                }
            }
            long[,] obstacleTile = (ConstVar.layers.Find(t => Equals(t.name, "obstacle"))).tileMap;
            if (move)
            {
                switch (state)
                {
                case walk.UP:
                    if (obstacleTile != null)
                    {
                        if (obstacleTile[(int)getTilePos(background).Y - 1, (int)getTilePos(background).X] == 0 || gamePos.Y > background.tileDim * getTilePos(background).Y + background.tileDim / 2)
                        {
                            collide    = false;
                            isRunning  = true;
                            currentRow = 3;
                            if (isGamer)
                            {
                                if (rect.Y > ConstVar.gameArea.Y || (gamePos.Y < ConstVar.gameArea.Y && rect.Y > 0))
                                {
                                    stepPos(0, -walkSpeed);
                                }
                                if (!(gamePos.Y < 0))
                                {
                                    stepGamePos(0, -walkSpeed);
                                }
                            }
                            else
                            {
                                stepGamePos(0, -walkSpeed);
                            }
                        }
                        else
                        {
                            collide = true;
                        }
                    }
                    else
                    {
                        isRunning  = true;
                        currentRow = 3;
                        stepGamePos(0, -walkSpeed);
                    }
                    break;

                case walk.DOWN:
                    if (obstacleTile != null)
                    {
                        if (obstacleTile[(int)getTilePos(background).Y + 1, (int)getTilePos(background).X] == 0 || gamePos.Y < background.tileDim * getTilePos(background).Y + background.tileDim * 0.9)
                        {
                            collide    = false;
                            isRunning  = true;
                            currentRow = 0;
                            if (isGamer)
                            {
                                if (rect.Y < ConstVar.displayDim.Y - ConstVar.gameArea.Y || (gamePos.Y > background.getRect().Height - ConstVar.gameArea.Y && rect.Y < ConstVar.displayDim.Y))
                                {
                                    stepPos(0, walkSpeed);
                                }
                                if (gamePos.Y < background.getRect().Height)
                                {
                                    stepGamePos(0, walkSpeed);
                                }
                            }
                            else
                            {
                                stepGamePos(0, walkSpeed);
                            }
                        }
                        else
                        {
                            collide = true;
                        }
                    }
                    else
                    {
                        isRunning  = true;
                        currentRow = 0;
                        stepGamePos(0, walkSpeed);
                    }
                    break;

                case walk.LEFT:
                    if (obstacleTile != null)
                    {
                        if (obstacleTile[(int)getTilePos(background).Y, (int)getTilePos(background).X - 1] == 0 || gamePos.X > background.tileDim * getTilePos(background).X + background.tileDim / 2)
                        {
                            collide    = false;
                            isRunning  = true;
                            currentRow = 1;
                            if (isGamer)
                            {
                                if (rect.X > ConstVar.gameArea.X || (gamePos.X < ConstVar.gameArea.X && rect.X > 0))
                                {
                                    stepPos(-walkSpeed, 0);
                                }
                                if (!(gamePos.X < 0))
                                {
                                    stepGamePos(-walkSpeed, 0);
                                }
                            }
                            else
                            {
                                stepGamePos(-walkSpeed, 0);
                            }
                        }
                        else
                        {
                            collide = true;
                        }
                    }
                    else
                    {
                        isRunning  = true;
                        currentRow = 1;
                        stepGamePos(-walkSpeed, 0);
                    }
                    break;

                case walk.RIGHT:
                    if (obstacleTile != null)
                    {
                        if (obstacleTile[(int)getTilePos(background).Y, (int)getTilePos(background).X + 1] == 0 || gamePos.X < background.tileDim * getTilePos(background).X + background.tileDim / 2)
                        {
                            collide    = false;
                            isRunning  = true;
                            currentRow = 2;
                            if (isGamer)
                            {
                                if (rect.X < ConstVar.displayDim.X - ConstVar.gameArea.X ||
                                    (gamePos.X > background.getRect().Width - ConstVar.gameArea.X && rect.X < ConstVar.displayDim.X))
                                {
                                    stepPos(walkSpeed, 0);
                                }

                                if (gamePos.X < background.getRect().Width)
                                {
                                    stepGamePos(walkSpeed, 0);
                                }
                            }
                            else
                            {
                                stepGamePos(walkSpeed, 0);
                            }
                        }
                        else
                        {
                            collide = true;
                        }
                    }
                    else
                    {
                        isRunning  = true;
                        currentRow = 2;
                        stepGamePos(walkSpeed, 0);
                    }
                    break;

                case walk.NOP:
                    isRunning = false;
                    break;
                }
            }
            if (!isGamer)
            {
                rect.X = background.getRect().X + (int)gamePos.X;
                rect.Y = background.getRect().Y + (int)gamePos.Y;
            }
        }
Beispiel #11
0
 protected internal override void OnCharEvent(CharEventArgs _event)
 {
     base.OnCharEvent(_event);
     fsm.OnCharEvent(_event);
 }
Beispiel #12
0
 // Make it safe so that functions are called properly.
 protected virtual void E_Spawn(CharEventArgs e)
 {
     if (OnSpawn != null)
     {
         OnSpawn(this, e);
     }
 }