public void SetLevel() { levelTimer = 0f; currentLevelName = LevelLoader.GetLevelName().Split('_')[1]; string[] levelNumberSplit = currentLevelName.Split('-'); currentPackIndex = Int32.Parse(levelNumberSplit[0]); currentLevelIndex = Int32.Parse(levelNumberSplit[1]); gameTimerText.text = $"Level {currentLevelName} : 00:00"; // Setting the default destroy settings currentDestoryMethod = DestroyMethod.Shape; destroyText.text = "Destroy by Shape"; // Getting the required shapes GameShape shape; requiredShapes = new Dictionary <int, ShapeData>(); // Getting the required Shapes/Slots for (int i = 0; i < solutionBoardParent.childCount; i++) { // Attempting to get the shape at the given index shape = solutionBoardParent.GetChild(i).gameObject.GetComponent <GameSlot>()?.GetSlotShape(); // Adding shape data if a shape exists if (shape != null) { requiredShapes.Add(i, shape.GetShapeData()); } } onLevelSet?.Invoke(currentPackIndex, currentLevelIndex); }
public object LoadResource(string name, string extension, System.Type type, out DestroyMethod destroyMethod) { string assetName = uiPath + name + extension; destroyMethod = DestroyMethod.None; string packageName = name.Substring(0, name.LastIndexOf('_')); if (!assets.ContainsKey(packageName)) { Debug.LogError("LoadResource No Package:" + packageName); return(null); } #if UNITY_EDITOR Asset asset = Assets.Load(assetName, type); if (asset != null) { assets[packageName].AddAsset(asset); return(asset.asset); } #else if (Assets.ContainsAsset(assetName)) { Asset asset = Assets.Load(assetName, type); if (asset != null) { assets[packageName].AddAsset(asset); return(asset.asset); } } #endif return(null); }
public object LoadResource(string name, string extension, System.Type type, out DestroyMethod destroyMethod) { object ret = GameEntry.FGUIData.GetFGui(name + extension); destroyMethod = DestroyMethod.Unload; if (!name.EndsWith("!a") && ret == null) { Log.Error("Load fuiAsset '{0}{1}' failed.", name, extension); } return(ret); }
public void ToggleDestoryMethod(DestroyMethod method) { switch (method) { case DestroyMethod.Shape: currentDestoryMethod = DestroyMethod.Shape; destroyText.text = "Destroy by Shape"; break; case DestroyMethod.Color: currentDestoryMethod = DestroyMethod.Color; destroyText.text = "Destroy by Color"; break; default: destroyText.text = "Unknown Destroy Method"; break; } onModeSwitch?.Invoke(); }
private static UnityEngine.Object LoadPackageInternal(string name, string extension, Type type, out DestroyMethod method) { ResourcesComponent resourcesComponent = Game.Scene.GetComponent <ResourcesComponent>(); method = DestroyMethod.Unload; switch (extension) { case ".bytes": { var req = resourcesComponent.LoadAsset <TextAsset>($"{name}{extension}"); return(req); } case ".png": //如果FGUI导出时没有选择分离通明通道,会因为加载不到!a结尾的Asset而报错,但是不影响运行 { var req = resourcesComponent.LoadAsset <Texture>($"{name}{extension}"); return(req); } } return(null); }