本文整理汇总了C#中Loader.load方法的典型用法代码示例。如果您正苦于以下问题:C# Loader.load方法的具体用法?C# Loader.load怎么用?C# Loader.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loader
的用法示例。
在下文中一共展示了Loader.load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
void Start()
{
complementaryFuzer = new ComplementaryFilter();
wiimote = GameObject.Find("wiimote");
Angles = new Vector3();
vSliderValuePrev = vSliderValue = 128f;
timer = new Timer(500.0);
timer.Elapsed += new ElapsedEventHandler(onTimerElapsed);
ui= this.GetComponent<UserInterfaceWindow>();
//supporting devices with custom drivers
//When you add them add specialized first then XInputDriver then wide range supporting drivers UnityDriver
#if (UNITY_STANDALONE_WIN)
InputManager.hidInterface.defaultDriver = new UnityDriver();
InputManager.AddDriver(new ThrustMasterDriver());
InputManager.AddDriver(new WiiDriver());
//InputManager.AddDriver(new XInputDriver());
#endif
#if (UNITY_STANDALONE_OSX)
//InputManager.AddDriver(new ThrustMasterDriver());
//InputManager.AddDriver(new XInputDriver());
InputManager.hidInterface.defaultDriver=new UnityDriver();
#endif
#if (UNITY_STANDALONE_ANDROID)
InputManager.AddDriver(new ThrustMasterDriver());
#endif
//TODO think of better entry point
InputManager.hidInterface.Enumerate();
// !!!Postive аxes mapping only currently(need to find way to distinct postive from negative axis in Unity way of handling)
// if(Application.isPlaying)
// InputManager.AddDriver(new UnityDriver());
//if you want to load some states from .xml and add custom manually first load settings xml
//!!!Application.streamingAssetPath gives "Raw" folder in web player
#if (UNITY_STANDALONE || UNITY_EDITOR ) && !UNITY_WEBPLAYER && !UNITY_ANDROID
//UnityEngine.Debug.Log("Standalone");
if (ui != null)
{//settingsXML would trigger internal loading mechanism (only for testing)
InputManager.loadSettings(Path.Combine(Application.streamingAssetsPath, "InputSettings.xml"));
ui.settings = InputManager.Settings;
}
manuallyAddStateAndHandlers();
#endif
#region Load InputSettings.xml Android
#if UNITY_ANDROID
Loader request = new Loader();
if (Application.platform == RuntimePlatform.Android)
{
if (File.Exists(Application.persistentDataPath + "/" + "InputSettings.xml"))
{
if (ui != null)
{
Debug.Log("Game>> Try to load from " + Application.persistentDataPath);
InputManager.loadSettings(Application.persistentDataPath + "/" + "InputSettings.xml");
ui.settings = InputManager.Settings;
manuallyAddStateAndHandlers();
return;
}
}
else
{// content of StreamingAssets get packed inside .APK and need to be load with WWW
request.Add(Path.Combine(Application.streamingAssetsPath, "InputSettings.xml"));
}
request.LoadComplete += new EventHandler<LoaderEvtArgs<List<WWW>>>(onLoadComplete);
request.Error += new EventHandler<LoaderEvtArgs<String>>(onLoadError);
request.LoadItemComplete += new EventHandler<LoaderEvtArgs<WWW>>(onLoadItemComplete);
request.load();
}
else //TARGET=ANDROID but playing in EDITOR => use Standalone setup
{
if (ui != null)
{//settingsXML would trigger internal loading mechanism (only for testing)
InputManager.loadSettings(Path.Combine(Application.streamingAssetsPath, "InputSettings.xml"));
ui.settings = InputManager.Settings;
}
//.........这里部分代码省略.........
示例2: Start
// Use this for initialization
void Start()
{
if (String.IsNullOrEmpty (settingsFileName)) {
Debug.LogError("Please add settings(.xml or .bin) fileName from StreamingAssets");
return;
}
ui= this.GetComponent<UserInterfaceWindow>();
//supporting devices with custom drivers
//When you add them add specialized first then XInputDriver then wide range supporting drivers like WinMM or OSXDriver
//supporting devices with custom drivers
//When you add them add specialized first then XInputDriver then wide range supporting drivers WinMM or OSXDriver
#if (UNITY_STANDALONE_WIN)
InputManager.AddDriver(new ThrustMasterDriver());
//InputManager.AddDriver(new WiiDriver());
InputManager.AddDriver(new XInputDriver());
//change default driver
//InputManager.hidInterface.defaultDriver=new UnityDriver();
#endif
#if (UNITY_STANDALONE_OSX)
InputManager.AddDriver(new ThrustMasterDriver());
InputManager.AddDriver(new XInputDriver());
//change default driver
//InputManager.hidInterface.defaultDriver=new UnityDriver();
#endif
#if (UNITY_STANDALONE_ANDROID)
InputManager.AddDriver(new ThrustMasterDriver());
InputManager.AddDriver(new XInputDriver());
#endif
if (profiles == null)
InputManager.hidInterface.LoadProfiles ("DeviceProfiles");
else
InputManager.hidInterface.SetProfiles (profiles);
InputManager.hidInterface.Enumerate();
//if you want to load some states from .xml and add custom manually first load settings xml
//!!!Application.streamingAssetPath gives "Raw" folder in web player
#if (UNITY_STANDALONE || UNITY_EDITOR ) && !UNITY_WEBPLAYER && !UNITY_ANDROID
//UnityEngine.Debug.Log("Standalone");
if (ui != null && !String.IsNullOrEmpty (settingsFileName))
{//settingsXML would trigger internal loading mechanism (only for testing)
//load settings from external file
ui.settings=InputManager.loadSettings(Path.Combine(Application.streamingAssetsPath, settingsFileName));
// ui.settings=InputManager.loadSettingsFromXMLText(Path.Combine(Application.streamingAssetsPath,settingsFileName));
//dispatch Event
this.m_onLoad.Invoke();
}
#endif
#region Load InputSettings.xml Android
#if UNITY_ANDROID
Loader request = new Loader();
if (Application.platform == RuntimePlatform.Android)
{
if (File.Exists(Application.persistentDataPath + "/" + settingsFileName))
{
if (ui != null)
{
Debug.Log("Game>> Try to load from " + Application.persistentDataPath);
ui.settings=InputManager.loadSettings(Application.persistentDataPath + "/" + settingsFileName);
//dispatch load complete
this.m_onLoad.Invoke();
return;
}
}
else
{// content of StreamingAssets get packed inside .APK and need to be load with WWW
request.Add(Path.Combine(Application.streamingAssetsPath, "InputSettings.xml"));
request.Add(Path.Combine(Application.streamingAssetsPath, "profiles.txt"));
request.Add(Path.Combine(Application.streamingAssetsPath, "xbox360_drd.txt"));
//....
//unpack everything in presistentDataPath
}
request.LoadComplete += new EventHandler<LoaderEvtArgs<List<WWW>>>(onLoadComplete);
request.Error += new EventHandler<LoaderEvtArgs<String>>(onLoadError);
request.LoadItemComplete += new EventHandler<LoaderEvtArgs<WWW>>(onLoadItemComplete);
//.........这里部分代码省略.........