Пример #1
0
 private void DisplayRemainingRocketCount()
 {
     if (!DisplayRocketCount)
     {
         return;
     }
     if (cameraController == null)
     {
         return;
     }
     if (cameraController.activeCamera == null)
     {
         return;
     }
     if (cameraController.activeCamera.CamMode == FixedCameraBlock.Mode.FirstPerson)
     {
         if (playerGroupedRockets.TryGetValue(StatMaster.isMP ? PlayerMachine.GetLocal().Player.NetworkId : 0, out groupedRockets))
         {
             string textString = "";
             foreach (var group in groupedRockets)
             {
                 textString += KeyCodeConverter.GetKey(group.Key).ToString() + ": " + group.Value.Count + Environment.NewLine;
             }
             GUI.Box(counterRect, LanguageManager.Instance.CurrentLanguage.RemainingRockets + Environment.NewLine + textString, groupedRocketsCounterStyle);
         }
     }
 }
Пример #2
0
        public override void DeSerialize(XData raw)
        {
            var keyArray    = (string[])(XStringArray)raw;
            var newKeyArray = new string[keyArray.Length];

            // replace bad keys
            for (int i = 0; i < keyArray.Length; ++i)
            {
                if (uint.TryParse(keyArray[i], out uint keyId) && keyId > MaxKey)
                {
                    newKeyArray[i] = KeyCodeConverter.GetKey(KeyPlaceHolder);
                }
                else
                {
                    newKeyArray[i] = keyArray[i];
                }
            }

            base.DeSerialize(new XStringArray("", newKeyArray));
            for (int i = 0; i < keyArray.Length; ++i)
            {
                var key = keyArray[i];
                if (!uint.TryParse(key, out uint extKey) || extKey < MaxKey)
                {
                    continue;
                }

                UpdatedKeyCodes[i] = extKey;
            }
            UpdateText();
            InvokeKeysChanged();
        }
Пример #3
0
 KeyCode ToKey(string value)
 {
     if (!KeyCodeConverter.GetKey(value, out KeyCode code))
     {
         throw new Exception("Invalid key " + value); // should never happen
     }
     return(code);
 }
Пример #4
0
 private void KeyCaptureCombo_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (locked)
     {
         return;
     }
     PreferenceManager.Database.ScreenCopyColorKey = KeyCodeConverter.GetKey(KeyCaptureCombo.SelectedIndex);
 }
Пример #5
0
        private void CopyToClipboardCombo_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (locked)
            {
                return;
            }

            PreferenceManager.Database.CopyToClipboardKey = KeyCodeConverter.GetKey(KeyCopyToClipboard.SelectedIndex);
        }
Пример #6
0
 public override void Deserialize(DataReader reader)
 {
     ScreenCopyColorKeyModifier = KeyCodeConverter.GetAltKey(reader.ReadInt32());
     ScreenCopyColorKey         = KeyCodeConverter.GetKey(reader.ReadInt32());
     CopyToClipboardKey         = KeyCodeConverter.GetKey(reader.ReadInt32());
     CopyToClipboardKeyModifier = KeyCodeConverter.GetAltKey(reader.ReadInt32());
     ColorSize              = reader.ReadInt32();
     ThemeColor             = (JColorStyle)reader.ReadInt32();
     Theme                  = (JThemeStyle)reader.ReadInt32();
     FirstTime              = reader.ReadBoolean();
     AutoCopyToClipboard    = reader.ReadBoolean();
     StayOnTop              = reader.ReadBoolean();
     ClipboardFormatingType = reader.ReadInt32();
     FormatTemplate         = reader.ReadString();
 }
Пример #7
0
 public string SerializeKey(uint x)
 {
     if (x > MaxKey)
     {
         return(x.ToString());
     }
     try
     {
         return(KeyCodeConverter.GetKey((KeyCode)x));
     }
     catch
     {
         return(x.ToString());
     }
 }
Пример #8
0
 private void OnGUI()
 {
     if (iAmLockedByRocket && DisplayWarning)
     {
         if (cameraController != null)
         {
             if (cameraController.activeCamera != null)
             {
                 if (cameraController.activeCamera.CamMode == FixedCameraBlock.Mode.FirstPerson)
                 {
                     DrawBorder();
                     GUI.Box(warningRect, "Missile Alert", missileWarningStyle);
                 }
             }
         }
     }
     if (DisplayRocketCount)
     {
         if (cameraController != null)
         {
             if (cameraController.activeCamera != null)
             {
                 if (cameraController.activeCamera.CamMode == FixedCameraBlock.Mode.FirstPerson)
                 {
                     if (playerGroupedRockets.TryGetValue(StatMaster.isMP ? PlayerMachine.GetLocal().Player.NetworkId : 0, out Dictionary <KeyCode, HashSet <TimedRocket> > groupedRockets))
                     {
                         string textString = "";
                         foreach (var group in groupedRockets)
                         {
                             textString += KeyCodeConverter.GetKey(group.Key).ToString() + ": " + group.Value.Count + Environment.NewLine;
                         }
                         GUI.Box(counterRect, LanguageManager.remainingRockets + Environment.NewLine + textString, groupedRocketsCounterStyle);
                     }
                 }
             }
         }
     }
 }
Пример #9
0
        public IEnumerable <uint> ParseText(string value, uint[] origKeys)
        {
            var keyParts = value.Split(';');
            var cnt      = keyParts.Length > origKeys.Length ? origKeys.Length : keyParts.Length;

            for (int i = 0; i < cnt; ++i)
            {
                if (uint.TryParse(keyParts[i], out uint val))
                {
                    yield return(val);
                }
                else
                {
                    if (KeyCodeConverter.GetKey(keyParts[i], out KeyCode code))
                    {
                        yield return((uint)code);
                    }
                    else
                    {
                        yield return(origKeys[i]);
                    }
                }
            }
        }
Пример #10
0
 bool IsKey(string value)
 {
     return(KeyCodeConverter.GetKey(value, out KeyCode code));
 }