예제 #1
0
        ///////////////////////////////        LOAD INPUT SETTINGS          //////////////////////
        /// <summary>
        /// Loads the input settings
        /// </summary>
        void loadInputSettings(UnityEngine.Object asset)
        {
            if (asset is TextAsset)
            {
                string text = ((TextAsset)asset).text;

                if (text != null && text.Length > 1)
                {
                    Debug.Log("Loading..." + _stateInputCombinations);

                    //clone
                    //_stateInputCombinations = new Dictionary<int,InputState> (_stateInputCombinations);
                    //Debug.Log ("Clone..." + _stateInputCombinations.Count);

                    //load
                                                                                #if (UNITY_STANDALONE || UNITY_EDITOR || UNITY_ANDROID) && !UNITY_WEBPLAYER
                    settings = InputManager.loadSettings(new StringReader(text));
                                                                                #else
                    settings = InputManager.loadSettingsFromText(text, false);
                                                                                #endif
                }
            }
            else
            {
                settings = InputManager.loadSettingsFromXMLText(AssetDatabase.GetAssetPath(settingsFile));
            }


            if (settings != null)
            {
                //assign settings
                _doubleClickDesignator  = settings.doubleDesignator;
                _doubleClickSensitivity = settings.doubleClickSensitivity;
                _combosClickSensitivity = settings.combinationsClickSensitivity;
                _singleClickSensitivity = settings.singleClickSensitivity;
                _longClickDesignator    = settings.longDesignator;
                _longClickSensitivity   = settings.longClickSensitivity;
                _spaceDesignator        = settings.spaceDesignator;

                _playerNumber        = settings.Players.Length;
                _playerIndexSelected = 0;
            }
        }
예제 #2
0
				///////////////////////////////        LOAD INPUT SETTINGS          //////////////////////
				/// <summary>
				/// Loads the input settings 
				/// </summary>
				bool loadInputSettings (UnityEngine.Object asset)
				{

					
						
						if (asset is TextAsset) {
							
								string text = ((TextAsset)asset).text;

								if (text != null && text.Length > 1) {

										Debug.Log ("Loading..." + _stateInputCombinations);

										//clone
										//_stateInputCombinations = new Dictionary<int,InputState> (_stateInputCombinations);
										//Debug.Log ("Clone..." + _stateInputCombinations.Count);		
						
										//load
										#if (UNITY_STANDALONE || UNITY_EDITOR || UNITY_ANDROID) && !UNITY_WEBPLAYER
											settings=InputManager.loadSettings (new StringReader (text));
										#else
										settings = InputManager.loadSettingsFromText (text, false);
										#endif

										

				
								
								
							
										

										
								
		
								}		

						} else {

								String path = AssetDatabase.GetAssetPath (settingsFile);
								if (!String.IsNullOrEmpty (path)) {
										_isBinary = Path.GetExtension (path) == ".bin";
                          
										if (_isBinary)
												settings = InputManager.loadSettingsFromBin (path);
										else
												settings = InputManager.loadSettingsFromXMLText (path);
								}
						}


						if (settings != null) {

								//assign settings
								_doubleClickDesignator = settings.doubleDesignator;
								_doubleClickSensitivity = settings.doubleClickSensitivity;
								_combosClickSensitivity = settings.combinationsClickSensitivity;
								_singleClickSensitivity = settings.singleClickSensitivity;
								_longClickDesignator = settings.longDesignator;
								_longClickSensitivity = settings.longClickSensitivity;
								_spaceDesignator = settings.spaceDesignator;
				
								_playerNumber = settings.Players.Length;
								_playerIndexSelected = 0;

								return true;

						}

						
						return false;
				}