コード例 #1
0
ファイル: ResourceManager.cs プロジェクト: astroffnet/Alex
        private bool CheckRequiredPaths(IProgressReceiver progressReceiver, out byte[] javaResources, out byte[] bedrockResources)
        {
            bedrockResources = null;

            try
            {
                Log.Info($"Verifiying assets...");
                string path = AssetsUtil.EnsureTargetReleaseAsync(JavaProtocol.VersionId, progressReceiver).Result;
                if (!Storage.TryReadBytes(path, out javaResources))
                {
                    Log.Error($"Could not load any assets! Are you connected to the internet?");

                    javaResources = null;
                    //bedrockResources = null;
                    return(false);
                }

                string bedrockPath = BedrockAssetUtil.CheckAndDownloadResources(progressReceiver).Result;
                if (!Storage.TryReadBytes(bedrockPath, out bedrockResources))
                {
                    Log.Error("Could not load any of the required Bedrock assets! Are you connected to the internet?");
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex, $"Could not check for latests assets! Do you have a internet connection up?");
                javaResources = null;
                //bedrockResources = null;
                return(false);
            }

            return(true);
        }
コード例 #2
0
        private bool CheckJavaAssets(IProgressReceiver progressReceiver, out byte[] javaResources)
        {
            try
            {
                string path = AssetsUtil.EnsureTargetReleaseAsync(JavaProtocol.VersionId, progressReceiver).Result;

                if (!Storage.TryReadBytes(path, out javaResources))
                {
                    Log.Error($"Could not load any assets! Are you connected to the internet?");

                    javaResources = null;

                    //bedrockResources = null;
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex, $"Could not check for latests assets! Are you connected to the internet?");
                javaResources = null;
                //bedrockResources = null;
                return(false);
            }

            return(true);
        }
コード例 #3
0
 Panel InstantiatePanel()
 {
     if (mBuiltinAsset != null)
     {
         GameObject go = Object.Instantiate(mBuiltinAsset.gameObject, mBuiltinAsset.transform.parent);
         go.name = Name;
         Panel panel = go.GetComponent <Panel>();
         panel.m_Mode     = Mode;
         panel.Properties = Properties;
         return(panel);
     }
     else
     {
         GameObject go = AssetsUtil.GetAsset <GameObject>(AssetPath);
         if (go == null)
         {
             return(null);
         }
         GameObject inst = Object.Instantiate(go, PanelManager.Instance.transform);
         inst.name = Name;
         var panel = inst.GetComponent <Panel>();
         panel.m_Mode     = Mode;
         panel.Properties = Properties;
         return(panel);
     }
 }
コード例 #4
0
 public void Apply()
 {
     foreach (ModuleLink moduleLink in modules)
     {
         ModuleInstaller.Install(moduleLink);
     }
     AssetsUtil.TriggerPostprocessEvent();
 }
コード例 #5
0
 private static void Refresh()
 {
     foreach (PluginInfo pluginInfo in plugins)
     {
         pluginInfo.Refresh();
     }
     AssetsUtil.TriggerPostprocessEvent();
     plugins.Clear();
     pluginsData.Clear();
 }
コード例 #6
0
    void Load(string name)
    {
        var path = AssetsUtil.GetAssetPath(name);//"TestPrefab");

        m_Mgr.Load(path, (handle) =>
        {
            var m_testPrefab = handle.Instantiate();
            //m_testPrefab.transform.parent = panel.transform;
            m_testPrefab.transform.localPosition = Vector3.zero;
            m_testPrefab.transform.localScale    = Vector3.one;
        });
    }
コード例 #7
0
ファイル: ResourceManager.cs プロジェクト: CiviledCode/Alex
        private bool CheckJavaAssets(IProgressReceiver progressReceiver, out string javaResources)
        {
            try
            {
                string assetDirectory = Path.Combine("assets", "java");

                string storedVersion;
                AssetsUtil.TryGetStoredVersion(out storedVersion);

                DirectoryInfo directoryInfo = null;
                if (storedVersion == null || !storedVersion.Equals(JavaProtocol.VersionId) || !Storage.TryGetDirectory(assetDirectory, out directoryInfo))
                {
                    Storage.TryDeleteDirectory(assetDirectory);

                    var zipPath = AssetsUtil.EnsureTargetReleaseAsync(JavaProtocol.VersionId, progressReceiver)
                                  .Result;

                    if (Storage.TryCreateDirectory(assetDirectory) &&
                        Storage.TryGetDirectory(assetDirectory, out directoryInfo))
                    {
                        Log.Info($"Extracting resources....");
                        using (ZipArchive zipArchive = new ZipArchive(Storage.OpenFileStream(zipPath, FileMode.Open)))
                        {
                            zipArchive.ExtractToDirectory(directoryInfo.FullName, true);
                        }
                    }
                }

                if (directoryInfo != null)
                {
                    javaResources = directoryInfo.FullName;

                    return(true);
                }

                javaResources = null;
                return(false);
            }
            catch (Exception ex)
            {
                Log.Error(ex, $"Could not check for latests assets! Are you connected to the internet?");
                javaResources = null;
                //bedrockResources = null;
                return(false);
            }

            return(true);
        }
コード例 #8
0
        public ISitcomResult Dom_Spawn(SitcomContext runtime, SitcomHeap target, string content, object[] args)
        {
            var names = new List <string>();

            if (!StringUtil.ParseArray(content, names, '\n') || names.Count == 0)
            {
                return(new SitcomValue(false));
            }
            var ret = new SitcomAsyncOperator();

            AssetsUtil.GetAssetAsync <GameObject>(args[0].ToString(), (x) =>
            {
                float f;
                if (args[3] != null)
                {
                    f = SitcomUtil.AsNumber(args[3]);
                }
                else
                {
                    f = 0;
                }
                Vector3 pos   = args[1] == null ? Vector3.zero : StringUtil.ParseVector3(args[1].ToString());
                Vector3 euler = args[2] == null ? Vector3.zero : StringUtil.ParseVector3(args[2].ToString());
                for (int i = 0; i < names.Count; i++)
                {
                    var go  = GameObject.Instantiate(x);
                    go.name = names[i];
                    var rad = Random.insideUnitCircle * f;
                    go.transform.position         = pos + new Vector3(rad.x, 0, rad.y);
                    go.transform.localEulerAngles = euler;
                    ret.Result = go;
                }
                ret.State = ESitcomState.Success;
            }, (error) =>
            {
                ret.Result = error;
                ret.State  = ESitcomState.Failed;
            });
            return(ret);
        }
コード例 #9
0
 string GetAssetPath(string name)
 {
     return(AssetsUtil.GetAssetPath(name));
 }
コード例 #10
0
 string GetSpriteName(string spriteName)
 {
     return(AssetsUtil.GetSpriteName(spriteName));
 }