Exemplo n.º 1
0
    /// <summary>
    /// 获取本地资源根路径
    /// </summary>
    /// <returns></returns>
    private string GetLocalResPath(RunPlaformType runPlatformType)
    {
        string path = string.Empty;

        switch (runPlatformType)
        {
        case RunPlaformType.Android:
            //注意这里原本是"jar:file://" + Application.dataPath + "!/assets/";
            //因为Application.dataPath开头有一个/,所以忽略一个"jar:file://"的/
            path = "jar:file:/" + Application.dataPath + "!/assets/Res/";
            break;

        case RunPlaformType.IOS:
            path = Application.dataPath + "/Raw/Res/";
            break;

        case RunPlaformType.WIN:
            path = Application.dataPath + "/StreamingAssets/Res/";
            break;

        case RunPlaformType.MAC:
            path = Application.dataPath + "/StreamingAssets/Res/";
            break;
        }
        return(path);
    }
Exemplo n.º 2
0
    } ///
    #endregion

    #region Method
    /// <summary>
    /// 获取运行平台
    /// </summary>
    /// <returns></returns>
    private RunPlaformType GetRunPlaformType()
    {
        RunPlaformType runPlaformType = RunPlaformType.IOS;

        switch (Application.platform)
        {
        case RuntimePlatform.Android:
            runPlaformType = RunPlaformType.Android;
            break;

        case RuntimePlatform.IPhonePlayer:
            runPlaformType = RunPlaformType.IOS;
            break;

        case RuntimePlatform.WindowsEditor:
        case RuntimePlatform.WindowsPlayer:
        case RuntimePlatform.WindowsWebPlayer:
            runPlaformType = RunPlaformType.WIN;
            break;

        case RuntimePlatform.OSXEditor:
        case RuntimePlatform.OSXPlayer:
        case RuntimePlatform.OSXWebPlayer:
            runPlaformType = RunPlaformType.MAC;
            break;
        }
        Debug.Log(runPlaformType);
        return(runPlaformType);
    }