Ejemplo n.º 1
0
    // Initialize the downloading url and AssetBundleManifest object.
    protected IEnumerator Initialize()
    {
        // Don't destroy the game object as we base on it to run the loading script.
        DontDestroyOnLoad(gameObject);

#if UNITY_EDITOR
        Debug.Log("We are " + (AssetBundleManager.SimulateAssetBundleInEditor ? "in Editor simulation mode" : "in normal mode"));
#endif

        string platformFolderForAssetBundles =
#if UNITY_EDITOR
            GetPlatformFolderForAssetBundles(EditorUserBuildSettings.activeBuildTarget);
#else
            GetPlatformFolderForAssetBundles(Application.platform);
#endif

        // Set base downloading url.
//		string relativePath = GetRelativePath();
        EditPlayerSettingsData data = ConfigManager.instance.GetEditPlayerSettingsData();
        string path = data.m_strS3Url.Replace("Assets/StreamingAssets/", "");
        AssetBundleManager.BaseDownloadingURL = path + kAssetBundlesPath + platformFolderForAssetBundles + "/";

        // Initialize AssetBundleManifest which loads the AssetBundleManifest object.
        var request = AssetBundleManager.Initialize(platformFolderForAssetBundles);
        if (request != null)
        {
            yield return(StartCoroutine(request));
        }
    }
Ejemplo n.º 2
0
    public void Load(string _strAssetName)
    {
        _strAssetName = _strAssetName.ToLower();
        //Debug.LogError (_strAssetName);
        MasterLoadPrefab.Data data = new MasterLoadPrefab.Data();


        foreach (MasterPrefabCSV temp in DataManager.master_prefab_list)
        {
            if (_strAssetName.Equals(temp.filename.ToLower()) == true)
            {
                data.filename = temp.filename;
                data.pre_load = temp.pre_load;
                data.path     = temp.path;
                break;
            }
        }
        EditPlayerSettingsData epsData = ConfigManager.instance.GetEditPlayerSettingsData();
        //string resultUrl = epsData.m_strS3Url + Define.ASSET_BUNDLES_ROOT + data.path.ToLower() +"/"+  data.filename.ToLower() + ".unity3d";
        string resultUrl = epsData.m_strS3Url + "/" + data.path + "/" + data.filename + ".unity3d";

        Debug.Log(resultUrl);

        Load(data.filename.ToLower(), resultUrl, data.version, m_goParent);
    }
Ejemplo n.º 3
0
 public EditPlayerSettingsData GetEditPlayerSettingsData()
 {
     if (m_EditPlayerSettingsData == null)
     {
         Debug.Log("no EditPlayserSettingsData");
         UnityEngine.Object player_settings_assets;
         player_settings_assets   = Resources.Load("EditPlayerSettingsData");
         m_EditPlayerSettingsData = (EditPlayerSettingsData)player_settings_assets;
     }
     return(m_EditPlayerSettingsData);
 }
Ejemplo n.º 4
0
    public void Load(string _strAssetName, string _strPath, int _iVersion)
    {
        EditPlayerSettingsData epsData = ConfigManager.instance.GetEditPlayerSettingsData();
        string resultUrl = epsData.m_strS3Url + Define.ASSET_BUNDLES_ROOT + "/" + _strPath + "/" + _strAssetName + ".unity3d";

        resultUrl = epsData.m_strS3Url + "/" + _strPath + "/" + _strAssetName + ".unity3d";


        //Debug.Log (resultUrl);
        //Debug.Log (_strAssetName);
        Load(_strAssetName, resultUrl, _iVersion, m_goParent);
    }
Ejemplo n.º 5
0
    //Assetbundleリスト専用のローダー
    public IEnumerator LoadAssetbundleListGo(LoadAssetbundleListCallBack callback)
    {
        // キャッシュシステムの準備が完了するのを待ちます
        while (!Caching.ready)
        {
            yield return(null);
        }

        //TODO 後で修正
        int assetVersion = 0;
        //int assetVersion = DataManager.Instance.asset_version;

        //Debug.Log ("####### LoadAssetbundleList Ver :" + assetVersion );

        int             version = assetVersion;
        AssetBundleData assetBundleData;

//        string resultUrl = "file://" + SystemSetting.GetStreamingAssetspath() +   SystemSetting.GetAdminAssetListPath () + SystemSetting.GetDataListName () + "."+DEFINE.ASSET_BUNDLE_PREFIX+".unity3d";
        EditPlayerSettingsData data = ConfigManager.instance.GetEditPlayerSettingsData();
        string resultUrl            = data.m_strS3Url + Define.ASSET_BUNDLES_ROOT + SystemSetting.GetAdminAssetListPath() + SystemSetting.GetDataListName() + ".unity3d";

        //Debug.Log ("Loading :"+m_strLoadURL);
        Debug.Log("LoadAssetbundleListGo:" + resultUrl);
        // 同じバージョンが存在する場合はアセットバンドルをキャッシュからロードするか、またはダウンロードしてキャッシュに格納します。
        using (WWW www = WWW.LoadFromCacheOrDownload(resultUrl, version)) {
            yield return(www);

            if (www.error != null)
            {
                throw new Exception("WWWダウンロードにエラーがありました:" + www.error);
            }
            AssetBundle           bundle = www.assetBundle;
            GameObject            tmpObj = Instantiate(bundle.LoadAsset(SystemSetting.GetDataListName(), typeof(GameObject))) as GameObject;
            AssetBundleDataHolder assetBundleDataHolder = tmpObj.GetComponent <AssetBundleDataHolder>();
            assetBundleData = assetBundleDataHolder.assetBundleData;

            if (tmpObj == null)
            {
                Debug.LogError("アセットバンドルList内容に異常があります");
            }

            tmpObj.transform.parent = DataContainer.Instance.gameObject.transform;

            // メモリ節約のため圧縮されたアセットバンドルのコンテンツをアンロード
            bundle.Unload(false);
        }
        callback(assetBundleData);
    }
Ejemplo n.º 6
0
    public void LoadSetting()
    {
        UnityEngine.Object[] assets;
        assets = Resources.LoadAll("LoadSettingData");

        foreach (UnityEngine.Object asset in assets)
        {
            if (asset is LoadSettingData)
            {
                m_LoadSettingData = (LoadSettingData)asset;
            }
        }

        m_EditPlayerSettingsData = ConfigManager.instance.GetEditPlayerSettingsData();
        m_strLoadURL             = m_EditPlayerSettingsData.m_strS3Url;
    }
Ejemplo n.º 7
0
    public void Load(string _strAssetName)
    {
        MasterLoadAtlas.Data data = new MasterLoadAtlas.Data();
        foreach (MasterLoadAtlas.Data temp in DataContainer.Instance.MasterLoadAtlasList)
        {
            if (_strAssetName.Equals(temp.filename) == true)
            {
                data = temp;
                break;
            }
        }
        EditPlayerSettingsData epsData = ConfigManager.instance.GetEditPlayerSettingsData();
        string resultUrl = epsData.m_strS3Url + Define.ASSET_BUNDLES_ROOT + data.path + "/" + data.filename + ".unity3d";

        Load(data.filename, resultUrl, data.version, m_goParent);
    }
Ejemplo n.º 8
0
    //アセットバンドルからGameObjectを取り出し
    static GameObject GetAssetBundleInfo(string _assetbundleName, string _folderName)
    {
        //string source_path = "AssetbundleList/AssetBundleHolder."+DEFINE.ASSET_BUNDLE_PREFIX+".unity3d";
        //int assetVersion = DataManager.Instance.asset_version;

        //TODO 後でバージョン処理追加
        //int assetVersion = 0;


        //"file:///Users/kanada/Documents/WorkE/New Unity Project 6/Assets/StreamingAssets/";

        // ここのみ
        EditPlayerSettingsData data = ConfigManager.instance.GetEditPlayerSettingsData();
        string resultUrl            = data.m_strS3Url + _folderName + "/" + _assetbundleName + "Prefab." + ".unity3d";

        Debug.Log("Loading :" + resultUrl);

        // 同じバージョンが存在する場合はアセットバンドルをキャッシュからロードするか、またはダウンロードしてキャッシュに格納します。
        WWW www = new WWW(resultUrl);

        Debug.LogWarning("Load :" + resultUrl);

        if (www.error != null)
        {
            throw new Exception("WWWダウンロードにエラーがありました:" + www.error);
        }
        AssetBundle bundle = www.assetBundle;

        Debug.Log("ロードアセットバンドルファイル名 :" + _assetbundleName);


        GameObject tmpObj = Instantiate(bundle.LoadAsset(_assetbundleName + "Prefab", typeof(GameObject))) as GameObject;

        if (tmpObj == null)
        {
            Debug.LogError("アセットバンドルList内容に異常があります");
        }

        // メモリ節約のため圧縮されたアセットバンドルのコンテンツをアンロード
        bundle.Unload(false);

        return(tmpObj);
    }
Ejemplo n.º 9
0
    IEnumerator initialData(string _strFilename)
    {
        string fromPath = EditPlayerSettingsData.GetStreamingAssetPathHead() + Application.streamingAssetsPath + "/csv/" + _strFilename;
        string toPath   = Application.persistentDataPath + "/" + _strFilename;

        if (System.IO.File.Exists(toPath))
        {
            //if (false) {
            m_iDownloadCount += 1;
            yield return(0);
        }
        else
        {
            WWW www = new WWW(fromPath);
            while (!www.isDone)
            {
                yield return(null);
            }
            System.IO.File.WriteAllBytes(toPath, www.bytes);
            m_iDownloadCount += 1;
        }
    }
Ejemplo n.º 10
0
    void Update()
    {
        // ボリューム設定
        BGMsource.volume = volume.BGM;

        // ここ、変更があった時だけでいな
        for (int i = 0; i < (int)AUDIO_TYPE.MAX; i++)
        {
            float fVolume = 1.0f;
            switch ((AUDIO_TYPE)i)
            {
            case AUDIO_TYPE.BGM:
                fVolume = volume.BGM;
                break;

            case AUDIO_TYPE.SE:
                fVolume = volume.SE;
                break;

            case AUDIO_TYPE.VOICE:
                fVolume = volume.VOICE;
                break;

            case AUDIO_TYPE.JINGLE:
                fVolume = volume.JINGLE;
                break;

            default:
                fVolume = 1.0f;
                break;
            }
            foreach (AudioChannelData channnel in m_tAudioChannnelDataList[i])
            {
                channnel.m_tAudioSource.volume = fVolume;
            }
        }
        bgm_ctrl();

        bool bInit = false;

        if (m_eStepPre != m_eStep)
        {
            m_eStepPre = m_eStep;
            bInit      = true;
        }
        switch (m_eStep)
        {
        case STEP.IDLE:
            if (0 < m_strLoadFilenameQueue.Count)
            {
                m_eStep = STEP.LOAD;
            }
            break;

        case STEP.LOAD:
            if (bInit)
            {
                if (m_csAssetBundleAudio == null)
                {
                    m_csAssetBundleAudio = GetComponent <UtilAssetBundleAudio> ();
                }
                m_strLoadFilename = m_strLoadFilenameQueue.Dequeue();
                foreach (MasterAudioCSV data in DataManager.master_audio_list)
                {
                    if (data.filename.Equals(m_strLoadFilename))
                    {
                        m_tempLoadAudioData.filename   = data.filename;
                        m_tempLoadAudioData.audio_type = data.audio_type;
                        m_tempLoadAudioData.path       = data.path;
                        m_tempLoadAudioData.version    = data.version;

                        EditPlayerSettingsData epsData = ConfigManager.instance.GetEditPlayerSettingsData();

                        string resultUrl = epsData.m_strS3Url + "/" + data.path + "/" + data.filename + ".unity3d";

                        Debug.Log(resultUrl);
                        m_csAssetBundleAudio.Load(data.filename, resultUrl, 1);
                    }
                }
            }
            if (m_csAssetBundleAudio.IsLoaded())
            {
                m_eStep = STEP.IDLE;
            }
            break;

        case STEP.MAX:
        default:
            break;
        }
        return;
    }
Ejemplo n.º 11
0
    void OnGUI()
    {
        EditorGUILayout.LabelField("環境設定エディター");
        if (GUILayout.Button("設定"))
        {
            // 設定ボタンでキャッシュクリア
            Caching.CleanCache();

            //Debug.Log( "現在の環境は:" + m_eEnviroment );
            string strBundleIdentify = "none";
            string strS3Header       = Define.S3_SERVER_HEADER;

            m_strMypageUrl = "https://every-studio.com/";

            switch (m_eEnviroment)
            {
            case Define.ENVIROMENT.LOCAL:
                //m_strS3Url = strS3Header + "/development/";
                m_strS3Url        = GetLocalAssetBundlePath() + "/assets/assetbundleresource";
                m_strServerUrl    = "http://newapp-devlop-lb-1498349273.ap-northeast-1.elb.amazonaws.com:8080/";
                m_strNodejsUrl    = "ws://newapp-devlop-node-lb-776612323.ap-northeast-1.elb.amazonaws.com:3000/socket.io/";
                strBundleIdentify = "jp.app.bokunozoo";
                break;

            case Define.ENVIROMENT.STREAMING_ASSETS:
                m_strS3Url        = GetStreamingAssetsAssetBundlePath();
                strBundleIdentify = "jp.app.bokunozoo";
                break;

            case Define.ENVIROMENT.PRODUCTION:
            default:
                //m_strS3Url = strS3Header + "/production/";
                m_strS3Url        = strS3Header;
                m_bIsLocalModeS3  = false;
                m_bIsSecondS3     = false;
                strBundleIdentify = "jp.app.bokunozoo";
                m_strServerUrl    = "";
                break;
            }

            if (m_bIsLocalModeS3)
            {
            }

            if (m_bIsLocalModeServer)
            {
                m_strServerUrl = m_strLocalServerUrl;
            }


            m_strBundleIdentify = strBundleIdentify;

            /*
             * PlayerSettings.bundleIdentifier	= m_strBundleIdentify;
             * PlayerSettings.bundleVersion = m_strVersion;
             * PlayerSettings.companyName = m_strCompanyName;
             * PlayerSettings.productName = m_strProductName;
             */

            EditPlayerSettingsData resources_data = CreateInstance <EditPlayerSettingsData> ();
            resources_data.m_strVersion         = m_strVersion;
            resources_data.m_eEnviroment        = m_eEnviroment;
            resources_data.m_strCompanyName     = m_strCompanyName;
            resources_data.m_strProductName     = m_strProductName;
            resources_data.m_strBundleIdentify  = m_strBundleIdentify;
            resources_data.m_strServerUrl       = m_strServerUrl;
            resources_data.m_strS3Url           = m_strS3Url;
            resources_data.m_bIsLocalModeS3     = m_bIsLocalModeS3;
            resources_data.m_bIsSecondS3        = m_bIsSecondS3;
            resources_data.m_bIsLocalModeServer = m_bIsLocalModeServer;
            resources_data.m_strLocalServerUrl  = m_strLocalServerUrl;
            resources_data.m_strMypageUrl       = m_strMypageUrl;
            resources_data.m_strNodejsUrl       = m_strNodejsUrl;

            PlayerSettings.companyName = m_strCompanyName;
            PlayerSettings.productName = m_strProductName;
            //Debug.Log (PlayerSettings.productName);

            string directory_path = "Assets/EditorConfig/Resources";
            Directory.CreateDirectory(directory_path);
            string path = directory_path + "/EditPlayerSettingsData.asset";

            AssetDatabase.CreateAsset(resources_data, path);
            AssetDatabase.ImportAsset(path);
        }
        m_bIsLocalModeS3 = GUILayout.Toggle(m_bIsLocalModeS3, "LocalModeS3(True is Debug&Editor Only)");
        m_bIsSecondS3    = GUILayout.Toggle(m_bIsSecondS3, "Second (It is Development & Web Only)");

/*
 *              if( GUILayout.RepeatButton( "RepeatButton" ) ){
 *                      //Debug.Log( "RepeatButton!" );
 *              }
 */
        m_eEnviroment = (Define.ENVIROMENT)EditorGUILayout.EnumPopup("設定環境", m_eEnviroment);

        GUILayout.Label("Version");
        m_strVersion = GUILayout.TextField(m_strVersion);

        GUILayout.Label("CompanyName");
        m_strCompanyName = GUILayout.TextField(m_strCompanyName);

        GUILayout.Label("ProductName");
        m_strProductName = GUILayout.TextField(m_strProductName);
        GUILayout.Label("BundleIdentify");
        m_strBundleIdentify  = GUILayout.TextField(m_strBundleIdentify);
        m_bIsLocalModeServer = GUILayout.Toggle(m_bIsLocalModeServer, "LocalModeServer(True is Debug&Editor Only)");
        m_strLocalServerUrl  = GUILayout.TextField(m_strLocalServerUrl);



        if (GUILayout.Button("PlayerPrefs.DeleteAll"))
        {
            PlayerPrefs.DeleteAll();
        }

        /*
         * GUILayout.Label( "CompanyName" );
         * m_strCompanyName = GUILayout.TextField( m_strCompanyName );
         * GUILayout.Label( "CompanyName" );
         * m_strCompanyName = GUILayout.TextField( m_strCompanyName );
         * GUILayout.Label( "CompanyName" );
         * m_strCompanyName = GUILayout.TextField( m_strCompanyName );
         */
        /*
         * if( m_eEnviromentPre != m_eEnviroment ){
         *      m_eEnviromentPre  = m_eEnviroment;
         *      //Debug.Log( "Change Selecting Enviroment : " + m_eEnviroment);
         * }
         */

        return;
    }
Ejemplo n.º 12
0
    /*
     *
     * // なぜ分けたのか?
     * public int PlaySe( string _strFilename ){
     *      _strFilename = _strFilename.ToLower ();
     *      return recievePlaySound(_strFilename);
     * }
     * public int PlayBgm( string _strFilename ){
     *      _strFilename = _strFilename.ToLower ();
     *      Debug.Log (_strFilename);
     *      return recievePlaySound(_strFilename);
     * }
     */

    // Update is called once per frame
    void Update()
    {
        bool bInit = false;

        if (m_eStepPre != m_eStep)
        {
            m_eStepPre = m_eStep;
            bInit      = true;
        }
        switch (m_eStep)
        {
        case STEP.IDLE:
            if (0 < m_tAudioChannelQueue.Count)
            {
                m_eStep = STEP.LOAD;
            }
            break;

        case STEP.LOAD:
            if (bInit)
            {
                m_tChannnelData = m_tAudioChannelQueue.Dequeue();

                if (m_csAssetBundleAudio == null)
                {
                    m_csAssetBundleAudio = GetComponent <UtilAssetBundleAudio> ();
                }

                foreach (MasterAudioCSV data in DataManager.master_audio_list)
                {
                    if (data.filename.Equals(m_tChannnelData.m_strFilename))
                    {
                        m_tempLoadAudioData.filename   = data.filename;
                        m_tempLoadAudioData.audio_type = data.audio_type;
                        m_tempLoadAudioData.path       = data.path;
                        m_tempLoadAudioData.version    = data.version;

                        EditPlayerSettingsData epsData = ConfigManager.instance.GetEditPlayerSettingsData();

                        //Debug.Log (epsData.m_strS3Url);
                        //Debug.Log (data.path);

                        string resultUrl = epsData.m_strS3Url + "/" + data.path + "/" + data.filename + ".unity3d";

                        Debug.Log(resultUrl);
                        m_csAssetBundleAudio.Load(data.filename, resultUrl, 1);
                    }
                }
            }
            if (m_csAssetBundleAudio.IsLoaded())
            {
                //AudioClipData addData = new AudioClipData( m_tempLoadAudioData.audio_type , m_tempLoadAudioData.path , m_tempLoadAudioData.filename , m_cs
                //SoundManager.Instance.Add (m_tempAudioClipData);
                //SoundManager.Instance.PlaySE (m_strLoaingFile);

                SoundManager.Instance.PlaySound(m_tChannnelData);

                /*
                 *
                 * if (m_tempLoadAudioData.audio_type == (int)AUDIO_TYPE.SE) {
                 *      SoundManager.Instance.PlaySE (m_strLoaingFile);
                 * } else if (m_tempLoadAudioData.audio_type == (int)AUDIO_TYPE.VOICE) {
                 *      SoundManager.Instance.PlayVoice (m_strLoaingFile);
                 * }else if( m_tempLoadAudioData.audio_type == (int)AUDIO_TYPE.BGM ){
                 *      SoundManager.Instance.PlayBGM (m_strLoaingFile);
                 * } else {
                 *      Debug.Log ("unknown type");
                 * }
                 */
                m_eStep = STEP.IDLE;
            }
            break;

        case STEP.MAX:
        default:
            break;
        }
    }
Ejemplo n.º 13
0
 public void LoadSetting()
 {
     UnityEngine.Object player_settings_assets;
     player_settings_assets   = Resources.Load("EditPlayerSettingsData");
     m_EditPlayerSettingsData = (EditPlayerSettingsData)player_settings_assets;
 }