Ejemplo n.º 1
0
 public void startSetting()
 {
     isSetting = true;
     if (onSettingChange != null)
     {
         onSettingChange.Invoke("");
     }
 }
 private void Start()
 {
     homeCtrl = FindObjectOfType <HomeViewCtrl>();
     doneBtn.onClick.AddListener(() => {
         callback?.Invoke(input.text);
         homeCtrl.SendViewAway(this.transform);
     });
 }
Ejemplo n.º 3
0
 private void detectSetting()
 {
     foreach (string key in keyMap.Keys)
     {
         // 检测所有键的状态
         currentSingleKeyStates[key] = detectKeyDown(key);
         // 与上次记录做比较
         if (lastSingleKeyStates.ContainsKey(key) && lastSingleKeyStates[key] != currentSingleKeyStates[key])
         {
             bool isDownNow = currentSingleKeyStates[key];
             // 如果有新键按下,则加入设置键列表,并触发settingChange
             if (isDownNow)
             {
                 if (!settingKeysAll.Contains(key))
                 {
                     settingKeysAll.Add(key);
                     if (onSettingChange != null)
                     {
                         onSettingChange.Invoke(combineKeyString(settingKeysAll));
                     }
                 }
                 if (!settingKeysNow.Contains(key))
                 {
                     settingKeysNow.Add(key);
                 }
             }
             // 如果所有键都松开,而设置键列表不为空,则触发settingConfirm
             else
             {
                 if (settingKeysNow.Contains(key))
                 {
                     settingKeysNow.Remove(key);
                 }
                 if (settingKeysNow.Count == 0)
                 {
                     isSetting = false;
                     if (onSettingConfirm != null)
                     {
                         onSettingConfirm.Invoke(combineKeyString(settingKeysAll));
                     }
                     settingKeysAll.Clear();
                     settingKeysNow.Clear();
                 }
             }
         }
         // 记录上次状态
         lastSingleKeyStates[key] = currentSingleKeyStates[key];
     }
 }
Ejemplo n.º 4
0
        static void Main()
        {
            StringAction sa = new StringAction(ActOnObject);

            sa.Invoke("You have to use string here, not object");
        }