示例#1
0
 public void CharEntered(object sender, CharacterEventArgs e)
 {
     if (!this.bIsActive || this.bInputWaiting)
     {
         return;
     }
     if (e.Character == '\b')
     {
         if (this.sInput.Length > 0)
         {
             this.sInput = this.sInput.Substring(0, this.sInput.Length - 1);
         }
         return;
     }
     if (e.Character == '\r')
     {
         this.HandleInput();
         return;
     }
     bool arg_5F_0 = e.AltPressed;
     if (this.sInput.Length >= this.iMaxLength)
     {
         return;
     }
     if (!Program.game.xInput_Menu.KeyDown(Keys.LeftControl))
     {
         this.sInput += e.Character;
     }
 }
示例#2
0
 void EventInput_CharEntered(object sender, CharacterEventArgs e)
 {
     if (_subscriber == null)
         return;
     if (char.IsControl(e.Character))
     {
         //ctrl-v
         if (e.Character == 0x16)
         {
             //XNA runs in Multiple Thread Apartment state, which cannot recieve clipboard
             Thread thread = new Thread(PasteThread);
             thread.SetApartmentState(ApartmentState.STA);
             thread.Start();
             thread.Join();
             _subscriber.RecieveTextInput(_pasteResult);
         }
         else
         {
             _subscriber.RecieveCommandInput(e.Character);
         }
     }
     else
     {
         _subscriber.RecieveTextInput(e.Character);
     }
 }
示例#3
0
        public void CharEnteredHandler(object sender, CharacterEventArgs e)
        {
            if (e.Character == 9) // If tab was pressed, toggle the console
            {
                tabToggle = !tabToggle;
                sim.SetInputEnabled(!tabToggle);
            }

            if (tabToggle)
            {
                if (e.Character >= 32 && e.Character <= 126) // If the key is a printable ascii character, add it to the current input line
                {
                    inputText += e.Character;
                }
                else if (e.Character == 13) // If the enter key was pressed, evaluate current line, and reset the input
                {
                    EvaluateInput(inputText);
                    inputText = "";
                }
                else if (e.Character == 8) // If backspace was pressed, delete 1 character from the input
                {
                    if (inputText.Length > 0)
                    {
                        inputText = inputText.Substring(0, inputText.Length - 1);
                    }
                }
            }
        }
示例#4
0
        void EventInput_CharEntered(object sender, CharacterEventArgs e)
        {
            if (isHandled || !isActive)
            {
                isHandled = false;
                return;
            }
            CommandHistory.Reset();
            switch ((int)e.Character)
            {
            case ENTER: ExecuteBuffer(); break;

            case BACKSPACE:
                if (Buffer.Output.Length > 0)
                {
                    Buffer.Output = Buffer.Output.Substring(0, Buffer.Output.Length - 1);
                }
                break;

            case TAB: AutoComplete(); break;

            default:
                if (IsPrintable(e.Character))
                {
                    Buffer.Output += e.Character;
                }
                break;
            }
        }
 private void HandleInput(object sender, CharacterEventArgs e)
 {
     if (e.Character != '\b' && e.Character != '\r')
     {
         InsertChar(e.Character);
     }
 }
示例#6
0
 private void EventInput_CharEntered(object sender, CharacterEventArgs e)
 {
     if (e.Character == HotKey)
     {
         Visible = !Visible;
     }
 }
示例#7
0
 protected override void gotabokstav(object aSender, CharacterEventArgs argies)
 {
     if (argies.Character >= '0' && argies.Character <= '9' || AcceptedCharacters.Contains(argies.Character))
     {
         base.gotabokstav(aSender, argies);
     }
 }
示例#8
0
 /// <summary>
 /// Handles the character being loaded.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">Event args.</param>
 virtual protected void HandleCharacterLoaded(object sender, CharacterEventArgs e)
 {
     breath = e.Character.GetComponentInChildren <Breath>();
     if (breath == null)
     {
         Debug.LogWarning("The loaded character doesn't have a Breath component.");
     }
 }
示例#9
0
 private void CharacterPress(object sender, CharacterEventArgs args)
 {
     //Prevents an error from being thrown if the font does not support the entered character
     if (Gui.DefaultFont.Characters.Contains(args.Character))
     {
         _charEntered.Value = "Last char entered = " + new string(new[] { args.Character });
     }
 }
 /// <summary>
 /// Handles the character being loaded.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">Event args.</param>
 virtual protected void HandleCharacterLoaded(object sender, CharacterEventArgs e)
 {
     characterHealth = e.Character.GetComponent <CharacterHealth>();
     if (characterHealth == null)
     {
         Debug.LogWarning("The loaded character doesn't have a character health!");
     }
 }
示例#11
0
        private void gotChar(object sender, CharacterEventArgs e)
        {
            if (Game1.activeClickableMenu != this)
            {
                return;
            }
            char c = e.Character;

            if (c == '\r' || c == '\n')
            {
                if (typing == "")
                {
                    exitThisMenu(true);
                    return;
                }

                chat.Add(new ChatEntry(Game1.player, typing));
                if (Multiplayer.mode != Mode.Singleplayer)
                {
                    Multiplayer.sendFunc(new ChatPacket(Multiplayer.getMyId(), typing));
                }

                if (MultiplayerMod.DEBUG)
                {
                    if (typing.StartsWith("/instance ") && typing.Length > 10)
                    {
                        string baseLoc = null;
                        if (Game1.player.currentLocation is StardewValley.Locations.FarmHouse)
                        {
                            baseLoc = "FarmHouse";
                        }
                        if (Game1.player.currentLocation is StardewValley.Locations.Cellar)
                        {
                            baseLoc = "Cellar";
                        }

                        if (baseLoc != null)
                        {
                            Log.debug("Looking for " + baseLoc + "_" + typing.Substring(10));
                            if (Game1.getLocationFromName(baseLoc + "_" + typing.Substring(10)) != null)
                            {
                                Game1.warpFarmer(baseLoc + "_" + typing.Substring(10), (int)Game1.player.position.X / Game1.tileSize, (int)Game1.player.position.Y / Game1.tileSize, false);
                            }
                        }
                    }
                }

                typing = "";
            }
            else if (c == '\b' && typing.Length > 0)
            {
                typing = typing.Substring(0, typing.Length - 1);
            }
            else if (!char.IsControl(c))
            {
                typing += c;
            }
        }
示例#12
0
        private static void OnCharacterCreate(DOLEvent e, object sender, CharacterEventArgs args)
        {
            if (args == null)
            {
                return;
            }

            args.Character.Level = 50;
        }
示例#13
0
 private void EventInput_CharEntered(object sender, CharacterEventArgs e)
 {
     if (Visible && Selected)
     {
         if (char.IsControl(e.Character))
         {
             RecieveCommandInput(e.Character);
         }
         else
         {
             RecieveTextInput(e.Character);
         }
     }
 }
示例#14
0
        //After registering for the OnCharacterCreation Event this function
        //is called whenever a new character is created!
        public static void DOLTestCharacterCreation(DOLEvent e, object sender, EventArgs args)
        {
            CharacterEventArgs chArgs = args as CharacterEventArgs;

            if (chArgs == null)
            {
                return;
            }

            //We want our new characters to start with some money
            //chArgs.Character.Gold = 10;
            //chArgs.Character.Silver = 50;
            // since at least money loot is available we dont need start money
        }
示例#15
0
        public virtual void ButtonCommandCall(object sender)
        {
            Character          activeCharacter = (Character)sender;
            CharacterEventArgs eventArgs       = new CharacterEventArgs()
            {
                Character = activeCharacter
            };

            if (System.Windows.Forms.Control.ModifierKeys == Keys.Shift)
            {
                eventArgs.Shift = true;
            }

            InvokeCommand(eventArgs);
        }
 /// <summary>
 /// Handles the character loaded event.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">Event.</param>
 protected virtual void HandleCharacterLoaded(object sender, CharacterEventArgs e)
 {
     itemManager = e.Character.GetComponentInChildren<ItemManager>();
     if (itemManager != null)
     {
         itemManager.ItemCollected += HandleItemCollected;
         itemManager.Loaded += HandleItemCollected;
         itemManager.ItemConsumed += HandleItemCollected;
         LevelManager.Instance.Respawned += HandleRespawned;
         UpdateText ();
     } else {
         Debug.LogError ("Character was loaded but not ItemManager was found");
     }
     UpdateText ();
 }
示例#17
0
 /// <summary>
 /// Get character reference when character loaded.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">Event args.</param>
 void HandleCharacterLoaded(object sender, CharacterEventArgs e)
 {
     characterHealth = e.Character.GetComponent <CharacterHealth> ();
     if (characterHealth != null)
     {
         characterHealth.Died      += HandleChange;
         characterHealth.Loaded    += HandleChange;
         characterHealth.GainLives += HandleChange;
         UpdateText();
     }
     else
     {
         Debug.LogError("Loaded character didn't have a CharacterHealth");
     }
 }
 /// <summary>
 /// Handles the character loaded event.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">Event.</param>
 virtual protected void HandleCharacterLoaded(object sender, CharacterEventArgs e)
 {
     itemManager = e.Character.GetComponentInChildren <ItemManager>();
     if (itemManager != null)
     {
         itemManager.ItemCollected += HandleItemCollected;
         itemManager.Loaded        += HandleItemCollected;
         itemManager.ItemConsumed  += HandleItemCollected;
         UpdateText();
     }
     else
     {
         Debug.LogError("Character was loaded but not ItemManager was found");
     }
 }
示例#19
0
 void EventInput_CharEntered(object sender, CharacterEventArgs e)
 {
     if (focus)
     {
         if (e.Character != '\b' && e.Character != 27 && e.Character != 17 && e.Character != 22 && e.Character != 13)
         {
             AddCharacter(e.Character);
         }
         //if (e.Character == 13)
         //{
         //    AddCharacter(e.Character);
         //    GetCursorPosition();
         //    NewLine();
         //}
     }
 }
示例#20
0
 /// <summary>
 /// Handles the character loaded event
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">E.</param>
 void HandleCharacterLoaded(object sender, CharacterEventArgs e)
 {
     character = e.Character;
     if (autoShowOnGameOver)
     {
         characterHealth = character.GetComponentInChildren <CharacterHealth>();
         if (characterHealth)
         {
             characterHealth.GameOver += HandleGameOver;
         }
         else
         {
             Debug.LogWarning("Game over screen cannot be auto shown as it could not find a ChracterHealth");
         }
     }
 }
示例#21
0
 /// <summary>
 /// Handles the character being loaded.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">Event args.</param>
 virtual protected void HandleCharacterLoaded(object sender, CharacterEventArgs e)
 {
     characterHealth = e.Character.GetComponent <CharacterHealth>();
     if (characterHealth == null)
     {
         Debug.LogWarning("The loaded character doesn't have a character health!");
     }
     else if (images.Length * sprites.Length != characterHealth.MaxHealth)
     {
         Debug.LogWarning("Number of images times number of sprites should match the MaxHealth");
     }
     if (characterHealth != null)
     {
         RegisterListeners();
     }
 }
示例#22
0
        protected void UpdateText(object sender, CharacterEventArgs e)
        {
            if (HasFocus)
            {
                if (e.Character == (char)Keys.Back)
                {
                    if (trueText.Length > 0)
                        trueText = trueText.Remove(trueText.Length - 1);
                }
                else if (trueText.Length < MaxTextLength)
                    trueText += e.Character;
            }

            Text = "";
            for (int i = 0; i < trueText.Length; i++)
                Text += '*';
        }
示例#23
0
 private static void KeyboardInput__CharEntered(object sender, CharacterEventArgs e)
 {
     if (!char.IsControl(e.Character))
     {
         Game1.keyboardDispatcher.Subscriber?.RecieveTextInput(e.Character);
         return;
     }
     if (e.Character == '\u0016')
     {
         if (System.Windows.Forms.Clipboard.ContainsText())
         {
             Game1.keyboardDispatcher.Subscriber?.RecieveTextInput(System.Windows.Forms.Clipboard.GetText());
         }
         return;
     }
     Game1.keyboardDispatcher.Subscriber?.RecieveCommandInput(e.Character);
 }
示例#24
0
 protected void UpdateText(object sender, CharacterEventArgs e)
 {
     if (_hasFocus)
     {
         if (e.Character == (char)Keys.Back)
         {
             if (Text.Length > 0)
             {
                 Text = Text.Remove(Text.Length - 1);
             }
         }
         else if (Text.Length < _maxTextLength)
         {
             Text += e.Character;
         }
     }
 }
示例#25
0
        private static void OnGameEntered(DOLEvent e, object sender, CharacterEventArgs args)
        {
            GamePlayer player = sender as GamePlayer;

            if (player == null)
            {
                return;
            }
            switch (player.Realm)
            {
            case eRealm.Albion: player.MoveTo(238, 563499, 573780, 5408, 4094);; break;

            case eRealm.Midgard: player.MoveTo(238, 570011, 541058, 5408, 2059);; break;

            case eRealm.Hibernia: player.MoveTo(238, 534198, 534372, 5408, 1521);; break;
            }
        }
示例#26
0
        private static void OnCharacterCreate(DOLEvent e, object sender, CharacterEventArgs args)
        {
            if (args == null)
            {
                return;
            }

            switch ((eRealm)args.Character.Realm)
            {
            case eRealm.Hibernia:
                UpdateCharacterPosition(args.Character, 238, 534198, 534372, 5408, 1521);
                break;

            case eRealm.Midgard:
                UpdateCharacterPosition(args.Character, 238, 570011, 541058, 5408, 2059);
                break;

            case eRealm.Albion:
                UpdateCharacterPosition(args.Character, 238, 563499, 573780, 5408, 4094);
                break;
            }
        }
示例#27
0
        protected virtual void gotabokstav(object aSender, CharacterEventArgs argies)
        {
            switch (argies.Character)
            {
            case '\b':      //backspace
                if (myText.Length > 0)
                {
                    myText = myText.Substring(0, myText.Length - 1);
                }
                break;

            case '\r':     //return
                OnEnterPressed?.Invoke(this);
                break;

            case '\t':     //tab
                OnTabPressed?.Invoke(this);
                break;

            default:
                myText += argies.Character;
                break;
            }
        }
示例#28
0
        /// <summary>
        /// Change location on character creation
        /// </summary>
        public static void CharacterCreation(DOLEvent ev, object sender, EventArgs args)
        {
            CharacterEventArgs chArgs = args as CharacterEventArgs;

            if (chArgs == null)
            {
                return;
            }
            DOLCharacters ch = chArgs.Character;

            try
            {
                StartLocation   startLocation     = null;
                GameClient      client            = chArgs.GameClient;
                StartupLocation dbStartupLocation = null;

                // do we have custom locations in the DB ?
                if (ServerProperties.Properties.USE_CUSTOM_START_LOCATIONS)
                {
                    // First try to find an ALL entry
                    var startupLocations = GameServer.Database.SelectObjects <StartupLocation>("ClassIDs = 'ALL'");
                    if (startupLocations.Count > 0)
                    {
                        dbStartupLocation = startupLocations[0];
                    }
                    else
                    {
                        // find realm-based SL
                        startupLocations = GameServer.Database.SelectObjects <StartupLocation>("ClassIDs LIKE '%" + GlobalConstants.RealmToName((eRealm)ch.Realm).Substring(0, 3) + "%'");
                        if (startupLocations.Count > 0)
                        {
                            dbStartupLocation = startupLocations[0];
                        }
                        else
                        {
                            // find class-based SL
                            startupLocations = GameServer.Database.SelectObjects <StartupLocation>("ClassIDs LIKE '%" + ch.Class + "%'");
                            foreach (var curSL in startupLocations)
                            {
                                foreach (var classID in curSL.ClassIDs.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
                                {
                                    int charClass = 0;
                                    int.TryParse(classID, out charClass);
                                    if (charClass == ch.Class)
                                    {
                                        dbStartupLocation = curSL;
                                        break;
                                    }
                                }
                                if (dbStartupLocation != null)
                                {
                                    break;
                                }
                            }
                        }
                    }

                    // fill loc with our found SL
                    if (dbStartupLocation != null)
                    {
                        startLocation = new StartLocation(dbStartupLocation.XPos, dbStartupLocation.YPos, dbStartupLocation.ZPos, dbStartupLocation.Heading);
                        ch.Region     = dbStartupLocation.Region;
                    }
                }

                // no custom SL or custom SL not found
                if (dbStartupLocation == null)
                {
                    // tutorial all realms use the same region
                    // except if disabled in SP, v1.93+ start is in tutorial zone
                    if ((ch.Region == 27 || (int)client.Version >= (int)GameClient.eClientVersion.Version193) && !ServerProperties.Properties.DISABLE_TUTORIAL)
                    {
                        switch (ch.Realm)
                        {
                        case 1:                                 // alb
                            startLocation = new StartLocation(95638, 101322, 5340, 998);
                            break;

                        case 2:                                 // mid
                            startLocation = new StartLocation(226716, 232385, 5340, 1024);
                            break;

                        case 3:                                 // hib
                            startLocation = new StartLocation(357788, 363457, 5340, 1024);
                            break;
                        }
                    }
                    else if ((int)client.Version >= (int)GameClient.eClientVersion.Version193)
                    {
                        // no base classes, so we choose a common startuplocation per realm
                        switch (ch.Realm)
                        {
                        case 1:                                 // alb
                            startLocation = new StartLocation(562418, 512268, 2500, 2980);
                            break;

                        case 2:                                 // mid
                            startLocation = new StartLocation(802869, 726016, 4699, 1399);
                            break;

                        case 3:                                 // hib
                            startLocation = new StartLocation(347279, 489681, 5200, 2332);
                            break;
                        }
                    }
                    else if ((int)client.Version >= (int)GameClient.eClientVersion.Version180)
                    {
                        startLocation = (StartLocation)MainTownStartingLocations[ch.Class];
                    }
                    else if (ch.Region == 1 || ch.Region == 100 || ch.Region == 200)                     // all classic regions
                    {
                        startLocation = (StartLocation)ClassicLocations[ch.Race][ch.Class];
                    }
                    else if (ch.Region == 51 || ch.Region == 151 || ch.Region == 181)                     // all ShroudedIsles regions
                    {
                        startLocation = (StartLocation)ShroudedIslesLocations[ch.Race][ch.Class];
                    }
                    else
                    {
                        log.DebugFormat("tried to create char in unknown region {0}", ch.Region);
                        switch (ch.Realm)
                        {
                        default: ch.Region = 1; break;

                        case 2: ch.Region = 100; break;

                        case 3: ch.Region = 200; break;
                        }
                        startLocation = (StartLocation)ClassicLocations[ch.Race][ch.Class];
                    }
                }

                if (startLocation == null)
                {
                    log.Warn("startup location not found: account=" + ch.AccountName + "; char name=" + ch.Name + "; region=" + ch.Region + "; realm=" + ch.Realm + "; class=" + ch.Class + " (" + (eCharacterClass)ch.Class + "); race=" + ch.Race + " (" + (eRace)ch.Race + ")");
                }
                else
                {
                    ch.Xpos      = startLocation.X;
                    ch.Ypos      = startLocation.Y;
                    ch.Zpos      = startLocation.Z;
                    ch.Direction = startLocation.Heading;
                }

                BindCharacter(ch);
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("StartupLocations script: error changing location. account=" + ch.AccountName + "; char name=" + ch.Name + "; region=" + ch.Region + "; realm=" + ch.Realm + "; class=" + ch.Class + " (" + (eCharacterClass)ch.Class + "); race=" + ch.Race + " (" + (eRace)ch.Race + ")", e);
                }
            }
        }
示例#29
0
 void HandleRespawned(object sender, CharacterEventArgs e)
 {
     UpdateImages();
 }
示例#30
0
 public virtual void OnCharEntered(CharacterEventArgs e)
 {
 }
示例#31
0
 public void CharEnteredHandler(object sender, CharacterEventArgs e)
 {
 }
 public static void EventInput_CharEntered(object sender, char c, int lParam)
 {
     CharacterEventArgs e = new CharacterEventArgs(c, lParam);
     if(char.IsControl(e.Character)) {
         if(ReceiveCommand != null) {
             ReceiveCommand(sender, e);
         }
     }
     else {
         if(ReceiveChar != null) {
             ReceiveChar(sender, e);
         }
     }
 }
示例#33
0
 protected internal virtual void CharEntered(CharacterEventArgs e)
 {
 }
示例#34
0
 private async void OnCharacterLoaded(object s, CharacterEventArgs c)
 {
     this.CharLoaded = true;
 }
示例#35
0
            void CharacterUpdate(object source, CharacterEventArgs e) {
                //Unpack the event
                int[] oldPos = e.GetOldPosition();
                int[] newPos = e.GetNewPosition();
                char avatar = e.GetAvatar();

                //Update position, if necessary
                if (oldPos != newPos) {
                    if (GameboardLocationEmpty(newPos)) {
                        //Nothing's at the target destination. Go there
                        this.grid.SetValue(avatar, newPos);

                        //Set the old position to empty
                        //But first, check that 'oldPos' is within the current gridsize, as the grid may have been respawned at a lower size than the previous coordinates
                        if (oldPos[0] < gridSize && oldPos[1] < gridSize) {
                            this.grid.SetValue('-', oldPos);
                        }
                    }
                }

            }
示例#36
0
 void EventInput_CharEntered(object sender, CharacterEventArgs e)
 {
     if (isHandled || !isActive)
     {
         isHandled = false;
         return;
     }
     CommandHistory.Reset();
     switch ((int)e.Character)
     {
         case ENTER: ExecuteBuffer(); break;
         case BACKSPACE:
             if (Buffer.Output.Length > 0)
             {
                 Buffer.Output = Buffer.Output.Substring(0, Buffer.Output.Length - 1);
             }
             break;
         case TAB: AutoComplete(); break;
         default:
             if (IsPrintable(e.Character))
             {
                 Buffer.Output += e.Character;
             }
             break;
     }
 }
示例#37
0
 void EventInput_CharEntered(object sender, CharacterEventArgs e)
 {
     InputBox.AddCharToQueue(e.Character);
 }
示例#38
0
 private void OnCharEntered(CharacterEventArgs e)
 {
     if (char.IsControl(e.Character)) {
         //ctrl-v
         if (e.Character == 0x16) {
             //XNA runs in Multiple Thread Apartment state, which cannot receive clipboard
             Thread thread = new Thread(PasteThread);
             thread.SetApartmentState(ApartmentState.STA);
             thread.Start();
             thread.Join();
             ReceiveTextInput(_pasteResult);
         }
         else {
             ReceiveCommandInput(e.Character);
         }
     }
     else {
         ReceiveTextInput(e.Character);
     }
 }
示例#39
0
        private void CharacterEntered(object sender, CharacterEventArgs e)
        {
            StringBuilder selected;
            switch (selection)
            {
                case SelectedString.userName:
                    selected = userName;
                    break;
                case SelectedString.hostName:
                    selected = hostName;
                    break;
                case SelectedString.port:
                    selected = port;
                    break;
                default:
                    selected = null;
                    break;
            }

            // Add key to text buffer. If not a symbol key.
            if (!((int)e.Character < 32 || (int)e.Character > 126)) //From space to tilde
            {
                // Capitals are already supported in DLL so we don't have to worry about checking shift
                if (!(Keyboard.GetState().IsKeyDown(Keys.LeftControl) || Keyboard.GetState().IsKeyDown(Keys.RightControl)))
                {
                    selected.Append(e.Character);
                }
            }

            // Backspace - remove character if there are any
            if ((int)e.Character == 0x08 && selected.Length > 0)
            {
                selected.Remove(selected.Length - 1, 1);
            }
        }
示例#40
0
        protected internal override void CharEntered(CharacterEventArgs e)
        {
            var ch = e.Character;

            lock (RenderRule) {
                switch (ch)
                {
                case '\b': {
                    //Backspace <= remove selected or remove before cursor
                    if (RenderRule.HasSelected)
                    {
                        RenderRule.RemoveSelected();
                    }
                    else
                    {
                        RenderRule.BackSpace();
                    }
                    break;
                }

                case '\n':
                case '\r': {
                    //New Line <= Insert character after cursor
                    if (RenderRule.HasSelected)
                    {
                        RenderRule.RemoveSelected();
                    }
                    RenderRule.Insert(ch);
                    break;
                }

                case '\t': {
                    //Tabs currently not supported
                    return;
                }

                case (char)3: {
                    //Copy
                    Clipboard.SetDataObject(RenderRule.GetSelected(), true);
                    break;
                }

                case (char)22: {
                    //Paste
                    if (RenderRule.HasSelected)
                    {
                        RenderRule.RemoveSelected();
                    }

                    var dataObject = Clipboard.GetDataObject();
                    if (dataObject != null)
                    {
                        var text = dataObject.GetData(DataFormats.Text).ToString();
                        RenderRule.Insert(text);
                    }
                    break;
                }

                case (char)24: {
                    //Cut
                    if (RenderRule.HasSelected)
                    {
                        Clipboard.SetDataObject(RenderRule.GetSelected(), true);
                        RenderRule.RemoveSelected();
                    }
                    break;
                }

                default: {
                    //Add the character
                    if (RenderRule.HasSelected)
                    {
                        RenderRule.RemoveSelected();
                    }
                    RenderRule.Insert(ch);
                    RenderRule.SelectedChar = null;
                    break;
                }
                }
                RenderRule.BakeText();
            }

            ResetTimer();
        }
示例#41
0
 void EventInput_CharEntered(object sender, CharacterEventArgs e)
 {
     char character = e.Character;
     if (character == 'n' && Network.JoinedGame)
     {
         Weather.Toggle();
     }
     if (acceptTextInput && activeText != null)
     {
         if (character == 8)
         {
             if (activeText.TrueContents.Length != 0)
             {
                 activeText.Contents = activeText.TrueContents.Remove(this.textEditPosition - 1, 1);
                 textEditPosition--;
             }
         }
         else if (((character > 36 && character < 126) || character == 32) && activeText.TrueContents.Length < activeText.maxLength)
         {
             if (this.textEditPosition < activeText.TrueContents.Length)
                 activeText.Contents = activeText.TrueContents.Substring(0, this.textEditPosition) +
                     character + activeText.TrueContents.Substring(this.textEditPosition);
             else
                 activeText.Contents = activeText.TrueContents.Substring(0, this.textEditPosition) + character;
             textEditPosition++;
         }
         else
         {
             activeText.ToNextBox();
         }
     }
 }
 /// <summary>
 /// Handles the character being loaded.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">Event args.</param>
 protected virtual void HandleCharacterLoaded(object sender, CharacterEventArgs e)
 {
     characterHealth = e.Character.GetComponent<CharacterHealth>();
     if (characterHealth == null) Debug.LogWarning ("The loaded character doesn't have a character health!");
 }
示例#43
0
 public CharButtonEvent(CharacterEventArgs args)
 {
     Key = args.Character;
     Alt = args.AltPressed;
 }
 private void Terminal_CharacterChanged(object sender, CharacterEventArgs e)
 {
     InvalidateCharacter(e.Position);
 }
示例#45
0
 private void CharEventHandler(object sender, CharacterEventArgs eventArgs)
 {
     charEvents.Add(new CharButtonEvent(eventArgs));
 }
示例#46
0
 private void EventInput_CharEntered(object sender, CharacterEventArgs e)
 {
     if (e.Character == '\b' && GetTextboxByID(FocusedTextbox).Text.Length > 0)
     {
         GetTextboxByID(FocusedTextbox).Text = GetTextboxByID(FocusedTextbox).Text.Substring(0, GetTextboxByID(FocusedTextbox).Text.Length - 1);
     }
     else
     {
         if (e.Character != '\r' && e.Character != '\b' && e.Character != '\t' && (int) e.Character != 27)
         {
             GetTextboxByID(FocusedTextbox).Text += e.Character;
         }
     }
 }