Example #1
0
            public void UpdateWindow(UserInterfaceWindow window, PaperDoll paperDoll)
            {
                this.window    = window;
                this.paperDoll = paperDoll;

                if (paperDoll != null)
                {
                    this.backgroundPanel = (Panel)GetFieldValue("backgroundPanel", paperDoll);
                }
            }
 public DaggerfallInputMessageBox(
     IUserInterfaceManager uiManager,
     TextFile.Token[] textTokens,
     int maxCharacters            = 31,
     string textBoxLabel          = null,
     bool useParchmentBackGround  = true,
     UserInterfaceWindow previous = null)
     : base(uiManager, previous)
 {
     this.textBox.MaxCharacters = maxCharacters;
     this.useParchmentStyle     = useParchmentBackGround;
     this.SetTextBoxLabel(textBoxLabel);
     SetupBox(textTokens);
 }
 public DaggerfallInputMessageBox(
     IUserInterfaceManager uiManager,
     int textId,
     int maxCharacters            = 31,
     string textBoxLabel          = null,
     bool useParchmentBackGround  = true,
     bool showAtTopOfScreen       = false,
     UserInterfaceWindow previous = null)
     : base(uiManager, previous)
 {
     this.textBox.MaxCharacters = maxCharacters;
     this.useParchmentStyle     = useParchmentBackGround;
     this.SetTextBoxLabel(textBoxLabel);
     this.showAtTopOfScreen = showAtTopOfScreen;
     SetupBox(textId);
 }
        // 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;
                }

                manuallyAddStateAndHandlers();

            }

            #endif
            #endregion

            #if(UNITY_WEBPLAYER || UNITY_EDITOR) && !UNITY_STANDALONE && !UNITY_ANDROID
            Loader request = new Loader();

                //UNITY_WEBPLAYER: Application.dataPath "http://localhost/appfolder/"
                request.Add(Application.dataPath+"/StreamingAssets/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();
            #endif
        }
Example #5
0
 public BackgroundScreen(UserInterfaceWindow window, PaperDoll paperDoll)
 {
     UpdateWindow(window, paperDoll);
 }
Example #6
0
        // 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;
                }


                manuallyAddStateAndHandlers();
            }
#endif
            #endregion

#if (UNITY_WEBPLAYER || UNITY_EDITOR) && !UNITY_STANDALONE && !UNITY_ANDROID
            Loader request = new Loader();

            //UNITY_WEBPLAYER: Application.dataPath "http://localhost/appfolder/"
            request.Add(Application.dataPath + "/StreamingAssets/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();
#endif
        }
        // 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);
            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, settingsFileName));

                ui.settings = InputManager.Settings;
            }

            }

            #endif
            #endregion

            #if(UNITY_WEBPLAYER || UNITY_EDITOR) && !UNITY_STANDALONE && !UNITY_ANDROID
            Loader request = new Loader();

            //UNITY_WEBPLAYER: Application.dataPath "http://localhost/appfolder/"
            request.Add(Application.dataPath+"/StreamingAssets/"+settingsFileName);

            request.LoadComplete += new EventHandler<LoaderEvtArgs<List<WWW>>>(onLoadComplete);
            request.Error += new EventHandler<LoaderEvtArgs<String>>(onLoadError);
            request.LoadItemComplete += new EventHandler<LoaderEvtArgs<WWW>>(onLoadItemComplete);
            request.load();
            #endif
        }