コード例 #1
0
ファイル: NativeInterface.cs プロジェクト: xfilson/dn_asset
    static void OnComponentCallback(uint entityid, byte command, string arg)
    {
        NativeEntity entity = NativeEntityMgr.singleton.Get(entityid);

        switch (command)
        {
        case ASCII.C:
        {
            NativeEquipComponent ne = entity.GetComponent <NativeEquipComponent>();
            ne.ChangeHairColor(Color.red);
        }
        break;

        case ASCII.W:
        {
            NativeEquipComponent ne = entity.GetComponent <NativeEquipComponent>();
            ne.AttachWeapon(arg);
        }
        break;

        default:
            XDebug.LogError("not regist command ", command);
            break;
        }
    }
コード例 #2
0
        /// <summary>
        /// Overwrites the Adapter.CS files with the selected library specific version.
        /// </summary>
        /// <param name="newLib"></param>
        /// <returns>Returns true if successful.</returns>
        private static bool CopyUncompiledAdapters(NetworkLibrary newLib)        // string libSuffix)
        {
            bool success = false;

            string libSuffix = (newLib == NetworkLibrary.UNET) ? "UNET" : (newLib == NetworkLibrary.PUN2) ? "PUN2" : "PUN";

            var _MA = GetPathFromAssetName("MasterNetAdapter" + libSuffix);
            var _NA = GetPathFromAssetName("NSTNetAdapter" + libSuffix);
            var MA  = GetPathFromAssetName("MasterNetAdapter");
            var NA  = GetPathFromAssetName("NSTNetAdapter");

            // fail if any of these files were not found.
            if (_MA == "" || _NA == "" || MA == "" || NA == "")
            {
                return(false);
            }

            XDebug.Log("Switching to " + libSuffix + " adapters... recompiling should happen automatically.", true, true);

            if (MasterNetAdapter.NetworkLibrary != newLib)
            {
                success |= AssetDatabase.CopyAsset(_MA, MA);
            }

            if (NSTNetAdapter.NetLibrary != newLib)
            {
                success |= AssetDatabase.CopyAsset(_NA, NA);
            }

            return(success);
        }
コード例 #3
0
    // 文件拷贝
    public static bool copyDirectory(string sourceDirName, string destDirName, bool copySubDirs)
    {
        DirectoryInfo dir = new DirectoryInfo(sourceDirName);

        if (!dir.Exists)
        {
            XDebug.LogError("源目录不存在拷贝失败" + sourceDirName);
            return(false);
        }

        DirectoryInfo[] dirs = dir.GetDirectories();
        if (!Directory.Exists(destDirName))
        {
            Directory.CreateDirectory(destDirName);
        }

        FileInfo[] files = dir.GetFiles();
        foreach (FileInfo file in files)
        {
            string temppath = Path.Combine(destDirName, file.Name);
            file.CopyTo(temppath, false);
        }

        if (copySubDirs)
        {
            foreach (DirectoryInfo subdir in dirs)
            {
                string temppath = Path.Combine(destDirName, subdir.Name);
                copyDirectory(subdir.FullName, temppath, copySubDirs);
            }
        }
        return(true);
    }
コード例 #4
0
    //==========================================================
    //Orientation demo

    //Callback handler from OrientationStatusController.OnStatusChanged
    public void ReceiveOrientationChange(string status)
    {
        DateTime dt = DateTime.Now;

        XDebug.Log("[" + dt.ToString("HH:mm:ss") + "] " + status);
        XDebug.Log("Input.deviceOrientation = " + Input.deviceOrientation);
    }
コード例 #5
0
        public override EnumTaskStatus OnUpdate(object obj, float elapsedTime)
        {
            if (m_node.children == null || m_node.children.Count < 1)
            {
                return(EnumTaskStatus.Success);
            }

            while (m_index < m_node.children.Count)
            {
                if (m_runEnter)
                {
                    XDebug.Log(XBTConst.Tag, $"顺序节点 {m_index} {m_node.children[m_index].taskClassName}");
                    m_beahvior.Start(m_node.children[m_index], obj);
                    m_runEnter = false;
                }
                var status = m_beahvior.Update(obj, elapsedTime);
                if (status == EnumTaskStatus.Success)
                {
                    m_index    = m_index + 1;
                    m_runEnter = true;
                    continue;
                }
                return(status);
            }
            return(EnumTaskStatus.Success);
        }
コード例 #6
0
        public void ShowWindow(string name, object param = null)
        {
            XDebug.Log(XUIConst.Tag, $"ShowWindow {name}");
            XUIWindow window = null;

            if (m_dictWindows.ContainsKey(name))
            {
                window = m_dictWindows[name];
            }
            else
            {
                var paramBundle = new XUIParamBundle();
                paramBundle.AssetLoader        = AssetLoader;
                paramBundle.LocalizationLoader = LocalizationLoader;
                paramBundle.EventManager       = EventManager;
                paramBundle.MsgManager         = MsgManager;
                paramBundle.uiRoot             = uiRoot;
                paramBundle.TextureManager     = TextureManager;

                window = XObjectPool.Alloc <XUIWindow>();
                window.Init(this, paramBundle, name, param);
                m_listWindows.Add(window);
                m_dictWindows.Add(name, window);
            }
            window.DstState = XUIWindow.EnumState.Show;
            window.openTick = Time.realtimeSinceStartup;
        }
コード例 #7
0
    // Use this for initialization
    private void Start()
    {
        //Get Device API Level
        if (apiLevelText != null)
        {
            XDebug.Log(SystemInfo.operatingSystem);
#if !UNITY_EDITOR && UNITY_ANDROID
            int apiLevel = AndroidPlugin.GetAPILevel();
            apiLevelText.text = "Device API Level = " + apiLevel;
            XDebug.Log("Device API Level = " + apiLevel);
#endif
        }

        //Get system language
        if (languageText != null)
        {
            SystemLanguage lang   = Application.systemLanguage;
            var            strVal = Enum.GetName(typeof(SystemLanguage), lang);
            languageText.text = "System Language = " + (int)lang + " (" + strVal + ")";
        }

        if (hardVolToggle != null)
        {
            hardVolToggle.isOn = FindObjectOfType <HardVolumeController>().HardOperation;
            OnHardVolumeOperationChanged(hardVolToggle.isOn);
        }

        if (vibratorControl != null)
        {
            XDebug.Log("IsSupportedVibrator = " + vibratorControl.IsSupportedVibrator);
        }
    }
コード例 #8
0
        //异步加载
        public void LoadAssetAsync <T>(string assetName, Action <string, T> callback = null) where T : Object
        {
            XDebug.Log(XABConst.Tag, $"--加载AssetObject(异步) {assetName}");
            assetName = assetName.ToLower();
            var bundleName = AssetInfoManager.GetBundleNameByAssetName(assetName);

            if (string.IsNullOrEmpty(bundleName))
            {
                callback?.Invoke(assetName, null);
                return;
            }
            var obj = _GetOrCreateAO(assetName);

            obj.Retain();
            if (obj.State == EnumJobState.Done)
            {
                callback?.Invoke(assetName, obj.GetValue <T>());
                return;
            }
            if (obj.State == EnumJobState.Process)
            {
                obj.AddCallback((p1, p2) =>
                {
                    callback?.Invoke(p1, p2 as T);
                });
                return;
            }
            obj.LoadAsync <T>(this, assetName, (p1, p2) =>
            {
                callback?.Invoke(p1, p2 as T);
            });
        }
コード例 #9
0
    //CustomDialogController demo (When 'OK' button pressed)
    public void OnCustom(Dictionary <string, string> dic)
    {
        XDebug.Log("PluginTest2.OnCustom called");

        string str = string.Join(", ", dic.Select(e => e.Key + "=" + e.Value).ToArray());

        XDebug.Log(str);

        if (dic.ContainsKey("reset") && dic["reset"].ToLower() == "true")   //'Reset switch' in dialog
        {
            if (OnCustomReset != null)
            {
                OnCustomReset.Invoke();
            }

            if (OnToast != null)
            {
                OnToast.Invoke(customResetMessage);
            }
        }
        else
        {
            if (OnToast != null)
            {
                OnToast.Invoke(str);
            }
        }
    }
コード例 #10
0
        //异步加载
        public void LoadBundleAsync(string bundleName, Action <string, AssetBundle> callback = null)
        {
            XDebug.Log(XABConst.Tag, $"--加载AssetBundle(异步) {bundleName}");
            bundleName = bundleName.ToLower();
            var bundleInfo = AssetInfoManager.GetBundleInfo(bundleName);

            if (bundleInfo == null)
            {
                callback?.Invoke(bundleName, null);
                return;
            }

            var obj = _GetOrCreateAB(bundleName);

            obj.Retain();
            if (obj.State == EnumJobState.Done)
            {
                callback?.Invoke(bundleName, obj.GetValue());
                return;
            }
            if (obj.State == EnumJobState.Process)
            {
                obj.AddCallback(callback);
                return;
            }
            obj.LoadAsync(this, EnumFileLocation.Client, bundleInfo.bundleType, bundleName, callback);
        }
コード例 #11
0
        //同步加载
        public T LoadAsset <T>(string assetName) where T : Object
        {
            XDebug.Log(XABConst.Tag, $"--加载AssetObject(同步) {assetName}");
            assetName = assetName.ToLower();
            var bundleName = AssetInfoManager.GetBundleNameByAssetName(assetName);

            if (string.IsNullOrEmpty(bundleName))
            {
                return(null);
            }

            var obj = _GetOrCreateAO(assetName);

            obj.Retain();
            if (obj.State == EnumJobState.Done)
            {
                return(obj.GetValue <T>());
            }
            if (obj.State == EnumJobState.Process)
            {
                //正在执行异步加载,那么停止异步加载,直接同步加载
                obj.StopAsync();
            }
            obj.Load <T>(this, assetName);
            return(obj.GetValue <T>());
        }
コード例 #12
0
        //同步加载
        public AssetBundle LoadBundle(string bundleName)
        {
            XDebug.Log(XABConst.Tag, $"--加载AssetBundle(同步) {bundleName}");
            bundleName = bundleName.ToLower();
            var bundleInfo = AssetInfoManager.GetBundleInfo(bundleName);

            if (bundleInfo == null)
            {
                return(null);
            }
            var obj = _GetOrCreateAB(bundleName);

            obj.Retain();
            if (obj.State == EnumJobState.Done)
            {
                return(obj.GetValue());
            }
            if (obj.State == EnumJobState.Process)
            {
                //正在执行异步加载,那么停止异步加载,直接同步加载
                obj.StopAsync();
            }
            //这里会通过其他数据获取location类型
            obj.Load(this, EnumFileLocation.Client, bundleInfo.bundleType, bundleName);
            return(obj.GetValue());
        }
コード例 #13
0
    ContentInfo lastContent;     //For share file (Only last loaded)

    //Callback handler when MediaScanner scan completed.
    public void ReceiveMediaScan(ContentInfo info)
    {
        XDebug.Log("ReceiveMediaScan : " + info);

        lastContent = info;
        SetEnableShareButtons(!string.IsNullOrEmpty(lastContent.uri));
    }
コード例 #14
0
ファイル: ProcessHelper.cs プロジェクト: YoMi-w/Slua-
 private static void ErrorReceived(object sender, DataReceivedEventArgs eventArgs)
 {
     if (eventArgs.Data != null)
     {
         XDebug.LogError(eventArgs.Data);
     }
 }
コード例 #15
0
        public void Cleanup()
        {
#if LOG_ALL_MESSAGES
            XDebug.Log("MESSENGER Cleanup. Make sure that none of necessary listeners are removed.");
#endif

            List <int> messagesToRemove = new List <int>();

            foreach (KeyValuePair <int, Delegate> pair in mEventTable)
            {
                bool wasFound = false;

                foreach (int message in mPermanentMessages)
                {
                    if (pair.Key == message)
                    {
                        wasFound = true;
                        break;
                    }
                }

                if (!wasFound)
                {
                    messagesToRemove.Add(pair.Key);
                }
            }

            foreach (int message in messagesToRemove)
            {
                mEventTable.Remove(message);
            }
        }
コード例 #16
0
    // Use this for initialization
    private void Start()
    {
        //Get system language
        if (languageText != null)
        {
            SystemLanguage lang   = Application.systemLanguage;
            var            strVal = Enum.GetName(typeof(SystemLanguage), lang);
            languageText.text = "Language = " + (int)lang + " (" + strVal + ")";
        }

        if (hardVolToggle != null)
        {
            hardVolToggle.isOn = FindObjectOfType <HardVolumeController>().HardOperation;
            OnHardVolumeOperationChanged(hardVolToggle.isOn);
        }

        if (vibratorControl == null)
        {
            vibratorControl = FindObjectOfType <VibratorController>();
            if (vibratorControl != null)
            {
                XDebug.Log("IsSupportedVibrator = " + vibratorControl.IsSupportedVibrator);
            }
        }
    }
コード例 #17
0
        public void OnStartInterpolate(Frame frame, bool lateArrival = false, bool midTeleport = false)
        {
            // Don't apply the transform for frame offtick updates. Those are for teleports and weapon fire.
            //TODO: Likely no longer needed, frame 0 shoud only fire onrcv
            //if (frame.frameid == 0)// && !frame.updateType.IsTeleport())
            //	return;

            for (int eid = 0; eid < elementCount; ++eid)
            {
                TransformElement te = transformElements[eid];

                if (!cache_elementIsEnabled[eid])
                {
                    continue;
                }

                // Don't overwrite mid interpolation if this is a teleport override element, and we are mid teleport.
                if (lateArrival && midTeleport && te.teleportOverride)
                {
                    continue;
                }

                // Don't modify elements with late arriving data if it is null.
                if (lateArrival && te.frames[frame.frameid].xform.type == XType.NULL)
                {
                    XDebug.Log(!XDebug.logInfo ? null :
                               (Time.time + " <b>Null Late Arrival - NOTE if you keep seeing this davin - remove this test otherwise </b> " + te.snapshotFrameId + " " + te.targetFrameId));

                    continue;
                }

                te.Snapshot(frame, lateArrival, midTeleport);
            }
        }
コード例 #18
0
                // Runs the entire queue until the object is destroyed.
                // On each try, all the tasks will be executed. If one
                // task is not -at least- executed, a dummy "Blink"
                // operation will run.
                private async void RunQueue()
                {
                    XDebug debugger = new XDebug("Support", this, $"RunQueue()", debug);

                    debugger.Start();
                    bool ranLoop;

                    try
                    {
                        while (this != null && gameObject != null)
                        {
                            ranLoop = false;
                            while (tasks.TryDequeue(out Func <Task> task))
                            {
                                ranLoop = true;
                                await task();
                            }
                            if (!ranLoop)
                            {
                                await Tasks.Blink();
                            }
                        }
                    }
                    finally
                    {
                        debugger.End();
                    }
                }
コード例 #19
0
        public int GetSort(XUIWindow window)
        {
            int index = -1;

            for (int i = 0; i < m_ltSort.Count; ++i)
            {
                var temp = m_ltSort[i];
                if (temp == window)
                {
                    index = i;
                    break;
                }
                //层级越低排在越前面(越早绘制)
                if (window.layer < temp.layer)
                {
                    index = i;
                    break;
                }
                //层级相同,打开时间越小排在越前面(越早绘制)
                if (window.layer == temp.layer && window.openTick < temp.openTick)
                {
                    index = i;
                    break;
                }
            }

            if (index == -1)
            {
                index = m_ltSort.Count;
            }
            XDebug.Log(XUIConst.Tag, $"GetSort {window.name} {index}");
            return(index);
        }
コード例 #20
0
ファイル: MaterialEditor.cs プロジェクト: xfilson/dn_asset
        private static bool _FindSameMat(Material mat, string path)
        {
            if (matName.Contains(mat.name))
            {
                XDebug.Log(string.Format("Same Mat:{0}", mat.name));
            }
            else
            {
                matName.Add(mat.name);
            }
            Texture tex = mat.mainTexture;

            if (tex != null)
            {
                List <string> matList = null;
                if (matTexName.TryGetValue(tex.name, out matList))
                {
                    matList.Add(mat.name);
                }
                else
                {
                    matList = new List <string>();
                    matList.Add(mat.name);
                    matTexName.Add(tex.name, matList);
                }
            }
            return(true);
        }
コード例 #21
0
ファイル: UIManager.cs プロジェクト: xfilson/dn_asset
 public bool Unload(IUIDlg dlg)
 {
     if (Exist(dlg))
     {
         if (dlg.pushStack)
         {
             var v = m_stack.Peek();
             if (v.id == dlg.id)
             {
                 DestroyDlg(dlg);
                 m_stack.Pop();
             }
             else
             {
                 XDebug.LogError("dlg is not in stack ", dlg.fileName);
             }
         }
         else
         {
             for (int i = 0, max = m_list.Count; i < max; i++)
             {
                 if (m_list[i].id == dlg.id)
                 {
                     DestroyDlg(dlg);
                     m_list.RemoveAt(i);
                     break;
                 }
             }
         }
         return(true);
     }
     return(false);
 }
コード例 #22
0
ファイル: NativeInterface.cs プロジェクト: xfilson/dn_asset
    static void OnInitCallback(byte t, IntPtr ptr)
    {
        string command = Marshal.PtrToStringAnsi(ptr);

        switch (t)
        {
        case ASCII.L:
            XDebug.CLog(command);
            break;

        case ASCII.W:
            XDebug.CWarn(command);
            break;

        case ASCII.E:
            XDebug.CError(command);
            break;

        case ASCII.G:
            GameObject go = XResources.Load <GameObject>(command, AssetType.Prefab);
            go.name = command;
            break;

        case ASCII.U:
            XDebug.CLog("unload: " + command);
            break;

        default:
            XDebug.LogError(t + " is not parse symbol: " + command);
            break;
        }
    }
コード例 #23
0
        private static void SaveMeshAsset(Mesh mesh, Texture2D tex, int profession, string path)
        {
            int uvOffsetX = GetUVOffset(profession, mesh.name, s_CombineConfig);

            if (uvOffsetX >= 0)
            {
                ReCalculateUV(mesh, uvOffsetX);
            }
            else
            {
                XDebug.LogError("Find UV Error:", mesh.name);
            }

            CleanMesh(mesh);
            string meshPath = path + mesh.name + ".asset";

            AssetDatabase.CreateAsset(mesh, meshPath);
            if (tex != null)
            {
                string srcTexPath  = AssetDatabase.GetAssetPath(tex);
                string destTexPath = "Assets/Resources/Equipments/" + tex.name + ".tga";
                AssetDatabase.CopyAsset(srcTexPath, destTexPath);
            }
            AssetDatabase.SaveAssets();
        }
コード例 #24
0
ファイル: NativeInterface.cs プロジェクト: xfilson/dn_asset
    static void OnEntityCallback(uint entityid, byte command, uint arg)
    {
        switch (command)
        {
        case ASCII.E:
            NativeEntityMgr.singleton.Add <NativeEntity>(entityid, arg);
            break;

        case ASCII.R:
            NativeEntityMgr.singleton.Add <NativeRole>(entityid, arg);
            break;

        case ASCII.P:
            NativeEntityMgr.singleton.Player =
                NativeEntityMgr.singleton.Add <NativePlayer>(entityid, arg);
            break;

        case ASCII.M:
            NativeEntityMgr.singleton.Add <NativeMonster>(entityid, arg);
            break;

        case ASCII.N:
            NativeEntityMgr.singleton.Add <NativeNPC>(entityid, arg);
            break;

        case ASCII.U:
            NativeEntityMgr.singleton.Remv(entityid);
            break;

        default:
            XDebug.LogError("not regist command ", command);
            break;
        }
    }
コード例 #25
0
        /// <summary>
        /// Capture incoming Photon messages here.
        /// </summary>
        public static void OnEvent(EventData photonEvent)
        {
            byte msgId = photonEvent.Code;

            if (!callbacks.ContainsKey(msgId))
            {
                return;
            }

            // ignore messages from self.
            if (PhotonNetwork.IsMasterClient && PhotonNetwork.MasterClient.ActorNumber == photonEvent.Sender)
            {
                XDebug.Log("Master Client talking to self? Normal occurance for a few seconds after Master leaves the game and a new master is selected.");
                return;
            }

            byte[] buffer = (photonEvent.CustomData as byte[]);

            var cbs = callbacks[msgId];

            if (cbs.bufferCallbacks != null && cbs.bufferCallbacks.Count > 0)
            {
                foreach (var cb in cbs.bufferCallbacks)
                {
                    cb(buffer);
                }
            }
        }
コード例 #26
0
ファイル: NativeInterface.cs プロジェクト: xfilson/dn_asset
    static void OnEntitySync(uint entityid, byte command, ref VectorArr vec)
    {
        NativeEntity entity = NativeEntityMgr.singleton.Get(entityid);

        switch (command)
        {
        case ASCII.p:
            Vector3 pos = vec.ToVector();
            pos.y = NativeScene.singleton.TerrainY(pos);
            entity.transfrom.position = pos;
            break;

        case ASCII.s:
            entity.transfrom.localScale = vec.ToVector();
            break;

        case ASCII.r:
            entity.transfrom.rotation = Quaternion.Euler(vec.ToVector());
            break;

        case ASCII.f:
            entity.transfrom.forward = vec.ToVector();
            break;

        default:
            XDebug.LogError("not regist command ", command);
            break;
        }
    }
コード例 #27
0
    private void Awake()
    {
        #region Make Singleton
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        //Sets this to not be destroyed when reloading scene
        //DontDestroyOnLoad(gameObject);
        #endregion

        //ForceName
        this.name = "[MANAGER]GAME_SCENE_MANAGER";

        //Check Tag
        if (!this.gameObject.CompareTag("Manager"))
        {
            XDebug.LogErrorRed(this.name + "'s Tag is not set to Manager", "!!!ERROR!!!");
        }
    }
コード例 #28
0
    //Android Switch Dialog -> Callback handler
    private void ReceiveSwitches(string message)
    {
#if UNITY_EDITOR
        Debug.Log("ReceiveSwitches : message = " + message);
#endif
        ShowToast(message);

        //(*) Activate the "DebugConsole" in the hierarchy to see its parameters.
        XDebug.Clear();
        XDebug.Log("(ReceiveSwitches : message)");
        XDebug.Log(message, 3);

        string   str = "";
        string[] arr = message.Split('\n');
        for (int i = 0; i < arr.Length; i++)
        {
            switchChecks[i] = arr[i].EndsWith("true");
            if (switchChecks[i])
            {
                str += switchItems[i] + " entered the party.\n";
            }
        }

        XPlayerPrefs.SetArray(gameObject.name + SWITCH_PREF, switchChecks); //Save array values (PlayerPrefs)
        StartCoroutine(DelayedToast(str.Trim(), 3));                        //Show Android Toast with delay
    }
コード例 #29
0
    //Save the text of the displayed information in a file.
    //(*)To write to External Storage on Android, you need permission in the 'AndroidManifest.xml' file.
    //
    //表示されている情報のテキストをファイルに保存する。
    //※Android で External Storage に書き込みをするには、「AndroidManifest.xml」にパーミッションが必要。
    //Required : <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    public void SaveInfoText()
    {
#if UNITY_EDITOR
        Debug.Log("SaveInfoText called");
#elif UNITY_ANDROID
        if (AndroidPlugin.IsExternalStorageMountedReadWrite())
        {
            if (displayText != null && !string.IsNullOrEmpty(displayText.text))
            {
                string path = AndroidPlugin.GetExternalStorageDirectoryDocuments();   //API 19 or higher
                if (string.IsNullOrEmpty(path))
                {
                    path = AndroidPlugin.GetExternalStorageDirectory();
                }

                string file = path + "/info_" + DateTime.Now.ToString("yyMMdd_HHmmss") + ".txt";
                if (SaveText(displayText.text, file))
                {
                    XDebug.Log("Save to : " + file);

                    if (OnToast != null)
                    {
                        OnToast.Invoke(saveSuccessMessage);
                    }

                    if (OnMediaScan != null)
                    {
                        OnMediaScan.Invoke(file);
                    }
                }
            }
        }
#endif
    }
コード例 #30
0
    // Update is called once per frame
    //private void Update () {

    //}


    //Get the storage information
    //ストレージの情報を取得する
    public void GetInfo()
    {
        XDebug.Clear();
        //XDebug.Log("Application.dataPath = " + Application.dataPath);                         //ゲームデータのフォルダーパスを返します(読み取り専用)
        XDebug.Log("Application.persistentDataPath = " + Application.persistentDataPath);       //永続的なデータディレクトリのパスを返します(読み取り専用)
        //XDebug.Log("Application.streamingAssetsPath = " + Application.streamingAssetsPath);   //StreamingAssets フォルダーへのパスが含まれています(読み取り専用)
        //XDebug.Log("Application.temporaryCachePath = " + Application.temporaryCachePath);     //一時的なデータ、キャッシュのディレクトリパスを返します(読み取り専用)値はデータを保存できる一時的なディレクトリパスです。

#if !UNITY_EDITOR && UNITY_ANDROID
        XDebug.Log("----------------------------");
        XDebug.Log("IsExternalStorageEmulated = " + AndroidPlugin.IsExternalStorageEmulated());
        XDebug.Log("IsExternalStorageRemovable = " + AndroidPlugin.IsExternalStorageRemovable());
        XDebug.Log("IsExternalStorageMounted = " + AndroidPlugin.IsExternalStorageMounted());
        XDebug.Log("IsExternalStorageMountedReadOnly = " + AndroidPlugin.IsExternalStorageMountedReadOnly());
        XDebug.Log("IsExternalStorageMountedReadWrite = " + AndroidPlugin.IsExternalStorageMountedReadWrite());
        XDebug.Log("GetExternalStorageState = " + AndroidPlugin.GetExternalStorageState());
        XDebug.Log("GetExternalStorageDirectory = " + AndroidPlugin.GetExternalStorageDirectory());
        XDebug.Log("GetExternalStorageDirectoryAlarms = " + AndroidPlugin.GetExternalStorageDirectoryAlarms());
        XDebug.Log("GetExternalStorageDirectoryDCIM = " + AndroidPlugin.GetExternalStorageDirectoryDCIM());
        XDebug.Log("GetExternalStorageDirectoryDocuments = " + AndroidPlugin.GetExternalStorageDirectoryDocuments());
        XDebug.Log("GetExternalStorageDirectoryDownloads = " + AndroidPlugin.GetExternalStorageDirectoryDownloads());
        XDebug.Log("GetExternalStorageDirectoryMovies = " + AndroidPlugin.GetExternalStorageDirectoryMovies());
        XDebug.Log("GetExternalStorageDirectoryMusic = " + AndroidPlugin.GetExternalStorageDirectoryMusic());
        XDebug.Log("GetExternalStorageDirectoryNotifications = " + AndroidPlugin.GetExternalStorageDirectoryNotifications());
        XDebug.Log("GetExternalStorageDirectoryPictures = " + AndroidPlugin.GetExternalStorageDirectoryPictures());
        XDebug.Log("GetExternalStorageDirectoryPodcasts = " + AndroidPlugin.GetExternalStorageDirectoryPodcasts());
        XDebug.Log("GetExternalStorageDirectoryRingtones = " + AndroidPlugin.GetExternalStorageDirectoryRingtones());
#endif
    }
コード例 #31
0
ファイル: IFileLoader.cs プロジェクト: zobo/xdebugclient
 public void setClient(XDebug.Client client)
 {
     _client = client;
 }
コード例 #32
0
ファイル: Client.cs プロジェクト: zobo/xdebugclient
        /// <summary>
        /// Deal with the init-message xdebug sends us:
        ///     - See if we seem to be compatible language wise
        ///     - See if we're compatible protocol wise
        ///     - Find the initial file and fire off a ConnectionInitialized "event"
        /// 
        /// Returns true/false        
        /// </summary>        
        private bool handleInitMessage(XDebug.Response initMessage)
        {
            if (initMessage == null)
            {
                throw new Exception("Init message was empty.");
            }

            /* parse out the filename and check wether the version is
             * compatible with XdebugClient */

            XmlElement d = initMessage.XmlMessage.DocumentElement;

            if (d.Attributes["protocol_version"] != null)
            {
                string remoteVersion = d.Attributes["protocol_version"].Value;

                if (remoteVersion != supportedProtocolVersion)
                {
                    throw new Exception(
                        String.Format(
                            "Expected version '{0}' but got version '{1}' which is not supported.'",
                            supportedProtocolVersion,
                            remoteVersion
                        )
                    );

                }
            }

            if (d.Attributes["language"] != null)
            {
                string remoteLanguage = d.Attributes["language"].Value;

                if (remoteLanguage.ToLower() != supportedLanguage)
                {
                    throw new Exception(
                        String.Format(
                            "Expected language '{0}' but got '{1}' which is not supported.",
                            supportedLanguage,
                            remoteLanguage
                        )
                    );
                }
            }

            if (d.Attributes["fileuri"] != null)
            {
                string absoluteFilename = this.getLocalFilename(d.Attributes["fileuri"].Value);

                XDebugEventArgs xea = new XDebugEventArgs();
                xea.Filename = absoluteFilename;
                xea.EventType = XDebugEventType.ConnectionInitialized;

                if (this.EventCallback(xea))
                {
                    _State = XdebugClientState.Initialized;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                throw new Exception("Missing 'fileuri' attribute.");
            }

            return true;
        }
コード例 #33
0
ファイル: Client.cs プロジェクト: zobo/xdebugclient
        /// <summary>
        /// Send a command to XDebug. Returns a instance of the Response object or null
        /// upon failure.
        /// </summary>        
        public XDebug.Response SendCommand(XDebug.Command c)
        {
            string transactionId = "xdc" + _cmdCounter.ToString();
            string Message = "";

            _cmdCounter++;

            Message = String.Format(
                "{0} -i {1}",
                c.CommandText,
                transactionId
            );

            if (c.OptionsText.Length != 0)
            {
                Message += " " + c.OptionsText;
            }

            XDebugEventArgs e = new XDebugEventArgs();
            e.Message            = new XDebug.Response();
            e.Message.RawMessage = Message;
            e.EventType          = XDebugEventType.CommandSent;

            this.EventCallback(e);

            byte[] msg = System.Text.Encoding.ASCII.GetBytes(Message + "\0");
            this._client.Send(msg);

            return this.ReceiveMessage();
        }