Exemple #1
0
        //获取ui界面
        private async Task <UIView> GetUiView(AssetConfig assetConfig)
        {
            UIView uiView;

            if (!_allUiViews.TryGetValue(assetConfig, out uiView))
            {
                GameObject uiViewSource = await _resource.LoadAsset <GameObject>(assetConfig.AssetBundleName, assetConfig.AssetPath);

                if (uiViewSource == null)
                {
                    throw new Exception("uiview path not found:" + assetConfig.AssetBundleName + ":" + assetConfig.AssetPath);
                }

                GameObject uiViewClone = GameObject.Instantiate(uiViewSource);
                BindToUIRoot(uiViewClone);
                uiView = uiViewClone.GetComponent <UIView>();
                if (uiView == null)
                {
                    return(null);
                }
                _allUiViews[assetConfig] = uiView;
                return(uiView);
            }
            uiView.gameObject.SetActive(true);
            return(uiView);
        }
Exemple #2
0
 public IObservable <Unit> Init()
 {
     return(LoadAssetConfig().Do(assetConfig =>
     {
         _assetConfig = assetConfig;
     }).AsUnitObservable());
 }
Exemple #3
0
        public async Task <UIView> CreateUI(AssetConfig assetConfig)
        {
            UIView uiView = null;

            if (_allUiViews.TryGetValue(assetConfig, out uiView))
            {
                return(uiView);
            }

            GameObject uiViewSource = await _resource.LoadAsset <GameObject>(assetConfig.AssetBundleName, assetConfig.AssetPath);

            if (uiViewSource == null)
            {
                throw new Exception("UIView path not found:" + assetConfig.AssetBundleName + ":" + assetConfig.AssetPath);
            }

            GameObject uiViewClone = GameObject.Instantiate(uiViewSource);

            BindToUIRoot(uiViewClone);
            uiView = uiViewClone.GetComponent <UIView>();
            if (uiView == null)
            {
                throw new Exception("Can't get UIView Component!");
            }

            //_allUiViews[assetConfig] = uiView;
            _allUiViews.Add(assetConfig, uiView);
            uiView.OnInitUI();
            _uiInitArgs.UIView = uiView;
            _event.Trigger(this, _uiInitArgs);

            return(uiView);
        }
Exemple #4
0
        public override void SingleExecute(PlayerEntity player)
        {
            AssetManager.LoadAssetAsync(
                player,
                AssetConfig.GetCharacterModelAssetInfo(player.playerInfo.RoleModelId),
                _p3Handler.OnLoadSucc);

            if (player.isFlagSelf && HasFirstPerson(player.playerInfo.RoleModelId))
            {
                AssetManager.LoadAssetAsync(
                    player,
                    AssetConfig.GetCharacterHandAssetInfo(player.playerInfo.RoleModelId),
                    _p1Handler.OnLoadSucc);
            }

            var audioController = player.AudioController();

            if (audioController != null)
            {
                audioController.LoadMapAmbient(AssetManager);
            }
            Logger.InfoFormat("CharacterLog-- created client player entity {0}, id:{1}, avatarIds:{2}", player.entityKey,
                              player.playerInfo.RoleModelId,
                              string.Join(",", player.playerInfo.AvatarIds.Select(i => i.ToString()).ToArray()));
        }
Exemple #5
0
    public ModInfo(string name, AssetConfig assetConfig, ModConfig modConfig, AssetMapping mapping, string path)
    {
        Name        = name ?? throw new ArgumentNullException(nameof(name));
        AssetConfig = assetConfig ?? throw new ArgumentNullException(nameof(assetConfig));
        ModConfig   = modConfig ?? throw new ArgumentNullException(nameof(modConfig));
        Mapping     = mapping ?? throw new ArgumentNullException(nameof(mapping));
        Path        = path;
        AssetPath   = path;

        if (!string.IsNullOrEmpty(ModConfig.ShaderPath))
        {
            if (System.IO.Path.IsPathRooted(ModConfig.ShaderPath) || ModConfig.ShaderPath.Contains("..", StringComparison.Ordinal))
            {
                throw new FormatException(
                          $"The shader path ({ModConfig.ShaderPath}) for mod {Name} " +
                          "is invalid - asset paths must be a relative path to a location inside the mod directory");
            }

            ShaderPath = System.IO.Path.Combine(path, ModConfig.ShaderPath);
        }

        if (!string.IsNullOrEmpty(ModConfig.AssetPath))
        {
            if (System.IO.Path.IsPathRooted(ModConfig.AssetPath) || ModConfig.AssetPath.Contains("..", StringComparison.Ordinal))
            {
                throw new FormatException(
                          $"The asset path ({ModConfig.AssetPath}) for mod {Name} " +
                          "is invalid - asset paths must be a relative path to a location inside the mod directory");
            }

            AssetPath = System.IO.Path.Combine(Path, ModConfig.AssetPath);
        }
    }
Exemple #6
0
    public Assets(IFileSystem disk, IJsonUtil jsonUtil) // Everything in this class should be treated as read-only once the constructor finishes.
    {
        if (disk == null)
        {
            throw new ArgumentNullException(nameof(disk));
        }
        BaseDir = ConfigUtil.FindBasePath(disk);
        var assetIdConfigPath = Path.Combine(BaseDir, @"src/Formats/AssetIdTypes.json");
        var config            = GeneralConfig.Load(Path.Combine(BaseDir, "data/config.json"), BaseDir, disk, jsonUtil);

        AssetConfig   = AssetConfig.Load(config.ResolvePath("$(MODS)/Base/assets.json"), AssetMapping.Global, disk, jsonUtil);
        AssetIdConfig = AssetIdConfig.Load(assetIdConfigPath, disk, jsonUtil);

        AssetIdsByType   = FindAssetIdsByType(AssetIdConfig);
        ParentsByAssetId = FindAssetIdParents(AssetIdConfig, AssetIdsByType);
        AssetIdsByEnum   = FindAssetIdsForEnums(AssetConfig.IdTypes, AssetIdsByType);
        EnumsByAssetId   = FindEnumsByAssetId(AssetConfig.IdTypes, AssetIdsByType);
        // HandleIsomorphism(AssetConfig.IdTypes);

        // TODO: Build family based on IsomorphicToAttribute.
        // * AssetTypes in a family need to have a single-type AssetId
        // * AssetType families must have a single unambiguous leader
        // * The child types inherit their enum names from the leader
        // * Child types' mod specific enums need to be in 1:1 relationship with CopiedFrom attrib?
        // ....getting complicated.
    }
        private void LoadVehicle()
        {
            if (!_isLoading && _cachedVehicleEntity.Count > 0)
            {
                var vehicle = _cachedVehicleEntity.First.Value;
                _cachedVehicleEntity.RemoveFirst();

                var assetBundleName = vehicle.vehicleAssetInfo.AssetBundleName;
                var modelName       = vehicle.vehicleAssetInfo.ModelName;
                var position        = Vector3.zero;
                var rotation        = Quaternion.identity;
                if (!vehicle.hasVehicleType)
                {
                    vehicle.AddVehicleType((EVehicleType)vehicle.vehicleAssetInfo.VType);
                }

                if (vehicle.HasDynamicData())
                {
                    var dataComp = vehicle.GetDynamicData();
                    rotation = dataComp.Rotation;
                    position = dataComp.Position.ShiftedVector3();
                }
                AssetManager.LoadAssetAsync(vehicle, AssetConfig.GetVehicleAssetInfo(assetBundleName, modelName), OnLoadSucc, new AssetLoadOption(position: position, rotation: rotation));
                _logger.InfoFormat("created client vehicle entity {0}", vehicle.entityKey.Value);
                _isLoading = true;
            }
        }
Exemple #8
0
        //检查路径
        private AssetConfig CheckAssetPath(Type t)
        {
            int hashCode = t.GetHashCode();

            AssetConfig assetCofig = null;

            if (!_uiAssetPath.TryGetValue(hashCode, out assetCofig))
            {
                object[] attrs = t.GetCustomAttributes(typeof(UIViewAttribute), false);
                if (attrs.Length == 0)
                {
                    return(null);
                }
                UIViewAttribute uIViewAttribute = attrs[0] as UIViewAttribute;

                if (string.IsNullOrEmpty(uIViewAttribute?.ViewPath) || string.IsNullOrEmpty(uIViewAttribute.AssetBundleName))
                {
                    return(null);
                }
                assetCofig = new AssetConfig(uIViewAttribute.AssetBundleName, uIViewAttribute.ViewPath);

                _uiAssetPath[hashCode] = assetCofig;
            }
            return(assetCofig);
        }
Exemple #9
0
 public ModInfo(string name, AssetConfig assetConfig, ModConfig modConfig, string path)
 {
     Name        = name ?? throw new ArgumentNullException(nameof(name));
     AssetConfig = assetConfig ?? throw new ArgumentNullException(nameof(assetConfig));
     ModConfig   = modConfig ?? throw new ArgumentNullException(nameof(modConfig));
     Path        = path;
 }
Exemple #10
0
 public override void SingleExecute(PlayerEntity player)
 {
     AssetManager.LoadAssetAsync(player,
                                 AssetConfig.GetCharacterModelAssetInfo(player.playerInfo.RoleModelId),
                                 (new ModelLoadResponseHandler()).OnLoadSucc);
     _logger.InfoFormat("created client player entity {0}", player.entityKey);
 }
    public override void PreLoadAssets()
    {
        AssetConfig con = App.GetMgr <AssetManager>().GetAssetConfig(curGame.ToString());

        if (con != null)
        {
            string[] arr = con.GetPreloadArray();
            if (arr == null)
            {
                return;
            }
            UnityEngine.Object ob = null;
            for (int i = 0; i < arr.Length; i++)
            {
                if (!AssetUseRecorder.ExistAsset(arr[i]))
                {
                    ob = App.GetMgr <ResourceManager>().LoadAsset(arr[i]);
                    if (ob != null)
                    {
                        AssetUseRecorder.AddToStatic(arr[i], ob);   //预加载的资源生命周期完整保存
                    }
                }
            }
        }
    }
Exemple #12
0
        /// <summary>
        /// 打开UI
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public async void OpenUI <T>(params object[] parameters) where T : UIView
        {
            AssetConfig assetConfig = CheckAssetPath(typeof(T));

            if (assetConfig == null)
            {
                return;
            }

            UIView newUiView = null;

            if (!_allUiViews.ContainsKey(assetConfig))
            {
                newUiView = await CreateUI(assetConfig);
            }
            else
            {
                newUiView = GetUI <T>();
            }

            if (newUiView != null)
            {
                newUiView.Show();

                newUiView.OnShow(parameters);

                //触发打开事件
                _uiShowArgs.UIView = newUiView;
                _event.Trigger(this, _uiShowArgs);
            }
        }
        static public string File2Hash(string Platform, double version, string path)
        {
            path = path.Replace("\\", "/");
            //
            var files      = Directory.GetFiles(path, "*.*", SearchOption.AllDirectories);
            var tempDirect = path + "_Hash";

            //文件准备
            if (Directory.Exists(tempDirect))
            {
                Directory.Delete(tempDirect, true);
            }
            Directory.CreateDirectory(tempDirect);
            //生成配置
            var config = new AssetConfig();

            config.Platfrom = Platform;
            config.Version  = version;
            float count = 0;

            foreach (var f in files)
            {
                count++;
                EditorUtility.DisplayProgressBar(Platform + " 资源处理", string.Format("生成文件hash:{0}/{1}", count, files.Length), count / files.Length);
                var ext = Path.GetExtension(f).ToLower();
                if (ext == ".manifest" || ext == ".meta")
                {
                    continue;
                }
                //
                var hash = GetMD5HashFromFile(f);

                var localPath = f.Replace("\\", "/").Replace(path + "/", "");

                var item = new AssetItem()
                {
                    HashName  = hash,
                    LocalPath = localPath
                };

                config.Assets.Add(item);

                //开始拷贝
                try
                {
                    File.Copy(f, IPath.Combine(tempDirect, hash));
                }
                catch (Exception e)
                {
                    Debug.LogError("error file:" + f);
                    Debug.LogError(e);
                    throw;
                }
            }
            //生成配置
            File.WriteAllText(IPath.Combine(tempDirect, Platform + "_VersionConfig.json"), JsonMapper.ToJson(config));
            //
            return(tempDirect);
        }
Exemple #14
0
        void LoadMod(string dataDir, string modName)
        {
            if (string.IsNullOrEmpty(modName))
            {
                return;
            }

            if (_mods.ContainsKey(modName))
            {
                return;
            }

            if (modName.Any(c => c == '\\' || c == '/' || c == Path.DirectorySeparatorChar))
            {
                Raise(new LogEvent(LogEvent.Level.Error, $"Mod {modName} is not a simple directory name"));
                return;
            }

            string path = Path.Combine(dataDir, modName);

            var assetConfigPath = Path.Combine(path, "assets.json");

            if (!File.Exists(assetConfigPath))
            {
                Raise(new LogEvent(LogEvent.Level.Error, $"Mod {modName} does not contain an asset.config file"));
                return;
            }

            var modConfigPath = Path.Combine(path, "modinfo.json");

            if (!File.Exists(modConfigPath))
            {
                Raise(new LogEvent(LogEvent.Level.Error, $"Mod {modName} does not contain an modinfo.config file"));
                return;
            }

            var assetConfig = AssetConfig.Load(assetConfigPath);
            var modConfig   = ModConfig.Load(modConfigPath);
            var modInfo     = new ModInfo(modName, assetConfig, modConfig, path);

            // Load dependencies
            foreach (var dependency in modConfig.Dependencies)
            {
                LoadMod(dataDir, dependency);
                if (!_mods.TryGetValue(dependency, out var dependencyInfo))
                {
                    Raise(new LogEvent(LogEvent.Level.Error, $"Dependency {dependency} of mod {modName} could not be loaded, skipping load of {modName}"));
                    return;
                }

                modInfo.Mapping.MergeFrom(dependencyInfo.Mapping);
            }

            MergeTypesToMapping(modInfo.Mapping, assetConfig, assetConfigPath);
            AssetMapping.Global.MergeFrom(modInfo.Mapping);
            assetConfig.PopulateAssetIds(AssetMapping.Global);
            _mods.Add(modName, modInfo);
            _modsInReverseDependencyOrder.Add(modInfo);
        }
Exemple #15
0
        public override void SingleExecute(VehicleEntity vehicle)
        {
            var assetBundleName = vehicle.vehicleAssetInfo.AssetBundleName;
            var modleName       = vehicle.vehicleAssetInfo.ModelName;
            var assetInfo       = AssetConfig.GetVehicleAssetInfo(assetBundleName, modleName);

            AssetManager.LoadAssetAsync(vehicle, assetInfo, _loadResourceHandler.OnLoadSucc);
        }
    private bool m_Grounded;                           // Whether or not the player is grounded.

    // Use this for initialization
    void Start()
    {
        PlayerCanva = Instantiate(AssetConfig.GetPrefabByName("PlayerCanvas"), transform.position, Quaternion.identity);
        PlayerCanva.GetComponent <PlayerCanvaFollow>().OnSetTargetTransform(gameObject.transform);
        PlayerCanva.GetComponent <PlayerCanvaFollow>().OnSetPlayerName(PlayerName);
        _collider         = GetComponent <Collider>();
        _collider.enabled = isServer;
    }
 /// <summary>
 /// 初始化
 /// </summary>
 static public void Load(AssetConfig config)
 {
     assetMap = new Dictionary <string, string>();
     foreach (var item in config.Assets)
     {
         assetMap[item.LocalPath] = item.HashName;
     }
 }
Exemple #18
0
        public override void SingleExecute(VehicleEntity vehicle)
        {
            var name = vehicle.vehicleAssetInfo.AssetBundleName;

            AssetManager.LoadAssetAsync(vehicle, AssetConfig.GetVehicleHitboxAssetInfo(name), OnLoadSucc);

            _logger.DebugFormat("created client vehicle hitbox {0}", vehicle.entityKey.Value);
        }
        public override void SingleExecute(VehicleEntity vehicle)
        {
            var assetBundleName = vehicle.vehicleAssetInfo.AssetBundleName;
            var modelName       = vehicle.vehicleAssetInfo.ModelName;

            AssetManager.LoadAssetAsync(vehicle, AssetConfig.GetVehicleAssetInfo(assetBundleName, modelName), OnLoadSucc);
            _logger.InfoFormat("created client vehicle entity {0}", vehicle.entityKey.Value);
        }
Exemple #20
0
    public void ConfirmChanges()
    {
        if (configObject == null)
        {
            Debug.LogError("未填写配置文件");
            return;
        }
        foreach (DataSetting datas in configObject.TrackAssets)
        {
            int colums = configObject.TrackAssets.IndexOf(datas);
            for (int i = 0; i < datas.targetObjects.Count; i++)
            {
                int        row             = datas.targetObjects.IndexOf(datas.targetObjects[i]);
                GameObject SelectionTarget = GameObject.Find(datas.targetObjects[i].id);
                if (SelectionTarget == null)
                {
                    continue;
                }
                if (SelectionTarget.transform.childCount == 0)
                {
                    continue;
                }
                GameObject  prefab    = SelectionTarget.transform.GetChild(0).gameObject;
                TrackTarget tTarget   = configObject.TrackAssets[colums].targetObjects[row];
                string      assetPath = AssetDatabase.GetAssetPath(prefab);
                //Debug.LogWarning(assetPath);
                if (assetPath != "")
                {
                    tTarget.prefab = AssetDatabase.LoadAssetAtPath <GameObject>(assetPath);
                }
                else
                {
                    if (!AssetDatabase.IsValidFolder("Assets/Prefabs"))
                    {
                        AssetDatabase.CreateFolder("Assets", "Prefabs");
                    }
                    bool result = true;
                    PrefabUtility.SaveAsPrefabAsset(prefab, "Assets/Prefabs/" + datas.targetObjects[i].id + "_ARPrefab.prefab", out result);
                    if (result)
                    {
                        tTarget.prefab = AssetDatabase.LoadAssetAtPath <GameObject>("Assets/Prefabs/" + datas.targetObjects[i].id + "_ARPrefab.prefab");
                    }
                }
                //Debug.LogWarning(SelectionTarget.transform.GetChild(0).gameObject);

                tTarget.localOffset   = prefab.transform.localPosition;
                tTarget.localRotation = prefab.transform.localRotation;
                tTarget.localScale    = prefab.transform.localScale;
                configObject.TrackAssets[colums].targetObjects[row] = tTarget;
            }
        }
        AssetDatabase.SaveAssets();
        Debug.LogWarning("保存成功");
        AssetDatabase.Refresh();
        GiveUpChanges();
        AssetConfig.EditARAssetsAdapte();
        Selection.activeObject = configObject;
    }
        public override ScrollViewCell CreateCell(RecycleScrollView scrollView, AssetConfig config, int cellIndex)
        {
            SimpleImageCell cell = (SimpleImageCell)scrollView.CreateCell(CellIdentifier());

            cell.SetHeaderOffset(LogConsoleSettings.GetTreeViewOffsetByLevel(level));
            cell.SetBackgroundColor(LogConsoleSettings.GetCellColor(cellIndex));
            cell.SetSprite((Sprite)data);

            return(cell);
        }
Exemple #22
0
    public static void EditARAssetsAdapte()
    {
        if (ConfigObject == null)
        {
            Debug.LogError("Assets/AssetConfig.asset路径下无配置文件");
            return;
        }
        if (EditTarget != null)
        {
            DestroyImmediate(EditTarget);
        }
        AssetConfig configFile = ConfigObject;

        float heightOffset = 0.0f;

        foreach (DataSetting data in configFile.TrackAssets)
        {
            GameObject dataObject = new GameObject(data.xmlName);
            dataObject.transform.parent        = EditTarget.transform;
            dataObject.transform.localPosition = new Vector3(0.0f, 0.0f, heightOffset * 10.0f);

            float currentWidth  = 0.0f;
            float currentHeight = 0.0f;
            foreach (TrackTarget target in data.targetObjects)
            {
                GameObject targetObject = GameObject.CreatePrimitive(PrimitiveType.Plane);
                targetObject.name                    = target.id;
                targetObject.transform.parent        = dataObject.transform;
                targetObject.transform.localScale    = new Vector3(target.width, target.width, target.height);
                targetObject.transform.localPosition = new Vector3(currentWidth * 10.0f, 0.0f, 0.0f);
                currentHeight = Mathf.Max(currentHeight, target.height);
                currentWidth += (target.width + target.width * 0.1f);
                Material tMat       = new Material(Shader.Find("Standard"));
                string   sourcesTex = "Assets/Editor/Vuforia/ImageTargetTextures/" + data.xmlName.Replace("_xml", "").Replace("_dat", "") + "/" + target.id + "_scaled.jpg";
                Debug.Log("sources:" + sourcesTex);
                tMat.SetTexture("_MainTex", AssetDatabase.LoadAssetAtPath <Texture>(sourcesTex));
                tMat.SetFloat("_Glossiness", 0.0f);
                targetObject.GetComponent <Renderer>().sharedMaterial = tMat;

                if (target.prefab != null)
                {
                    GameObject view = Instantiate(target.prefab) as GameObject;
                    view.name                    = view.name.Replace("(Clone)", "");
                    view.transform.parent        = targetObject.transform;
                    view.transform.localPosition = target.localOffset;
                    view.transform.localRotation = target.localRotation;
                    view.transform.localScale    = target.localScale;
                }
            }
            Debug.LogWarning(currentHeight);
            heightOffset += (currentHeight + currentHeight * 0.1f);
        }
        Selection.activeObject = EditTarget;
    }
Exemple #23
0
 public void OnMyTeam(int other)
 {
     playerTeam = other;
     // myNameText.color = other == 1 ?
     //     new Color(52.0f / 255.0f, 114.0f / 255.0f, 161.0f / 255.0f, 1.0f)
     //     : new Color(161.0f / 255.0f, 92.0f / 255.0f, 52.0f / 255.0f, 1.0f);
     // print(other);
     CharIcon.sprite = AssetConfig.GetUIByName("team_" + other);
     CharIcon.gameObject.SetActive(false);
     CharIcon.gameObject.SetActive(true);
 }
        private static void WriteABsInfo(Dictionary <string, string> resPath)
        {
            var config = new AssetConfig
            {
                assetList = new List <AssetInfo>()
            };

            //var crc32 = new CRC32();
            foreach (var path in resPath.Keys)
            {
                var resDepend  = AssetDatabase.GetDependencies(path);
                var dependList = new List <string>();
                foreach (var depend in resDepend)
                {
                    if (depend == path || path.EndsWith(".cs"))
                    {
                        continue;
                    }

                    if (!resPath.TryGetValue(depend, out var name))
                    {
                        continue;
                    }

                    if (name == resPath[path])
                    {
                        continue;
                    }

                    if (!dependList.Contains(name))
                    {
                        dependList.Add(name);
                    }
                }

                var abBase = new AssetInfo(resPath[path], path, dependList);
                config.assetList.Add(abBase);
            }

#if DEBUG
            var xmlPath    = $"{Application.dataPath}/../Logs/AssetConfig.xml";
            var fileStream = new FileStream(xmlPath, FileMode.Create, FileAccess.Write, FileShare.Write);
            var writer     = new StreamWriter(fileStream, Encoding.UTF8);
            var serializer = new XmlSerializer(typeof(AssetConfig));
            serializer.Serialize(writer, config);
            writer.Close();
            fileStream.Close();
#endif
            var bytePath = $"{_exportPath}/AssetConfig.config";
            var fs       = new FileStream(bytePath, FileMode.Create, FileAccess.Write, FileShare.Write);
            var binary   = new BinaryFormatter();
            binary.Serialize(fs, config);
            fs.Close();
        }
        public override ScrollViewCell CreateCell(RecycleScrollView scrollView, AssetConfig config, int cellIndex)
        {
            BaseCheckboxCell cell = (BaseCheckboxCell)scrollView.CreateCell("CheckboxCell");

            cell.SetText(DisplayText);
            cell.SetHeaderOffset(LogConsoleSettings.GetTreeViewOffsetByLevel(level));
            cell.SetBackgroundColor(LogConsoleSettings.GetCellColor(cellIndex));
            cell.SetToggle(isOn);
            cell.OnValueChanged = OnValueChanged;
            return(cell);
        }
Exemple #26
0
 private void OnEnable()
 {
     configList.Clear();
     string[] guids = AssetDatabase.FindAssets("t:AssetConfig");
     for (int i = 0; i < guids.Length; i++)
     {
         string      guid        = guids[i];
         string      configPath  = AssetDatabase.GUIDToAssetPath(guid);
         AssetConfig assetConfig = AssetDatabase.LoadAssetAtPath(configPath, typeof(AssetConfig)) as AssetConfig;
         configList.Add(new AssetConfigInfo(configPath, assetConfig));
     }
 }
        public override ScrollViewCell CreateCell(RecycleScrollView scrollView, AssetConfig config, int cellIndex)
        {
            BaseSliderCell cell = (BaseSliderCell)scrollView.CreateCell("SliderCell");

            cell.SetText(DisplayText);
            cell.SetHeaderOffset(LogConsoleSettings.GetTreeViewOffsetByLevel(level));
            cell.SetBackgroundColor(LogConsoleSettings.GetCellColor(cellIndex));
            cell.SetConfig(min, max, wholeNumbers);
            cell.SetValue(value);
            cell.OnValueChanged = OnValueChanged;
            return(cell);
        }
Exemple #28
0
 public IObservable <Unit> Init()
 {
     return(CachingIsReady().ContinueWith(_ =>
     {
         return _manifestLoader.LoadManifest();
     }).ContinueWith(_ =>
     {
         return LoadAssetConfig().Do(assetConfig =>
         {
             _assetConfig = assetConfig;
         }).AsUnitObservable();
     }));
 }
Exemple #29
0
        static void MergeTypesToMapping(AssetMapping mapping, AssetConfig config, string assetConfigPath)
        {
            foreach (var assetType in config.Types)
            {
                var enumType = Type.GetType(assetType.Key);
                if (enumType == null)
                {
                    throw new InvalidOperationException($"Could not load enum type \"{assetType.Key}\" defined in \"{assetConfigPath}\"");
                }

                mapping.RegisterAssetType(assetType.Key, assetType.Value.AssetType);
            }
        }
    public void OnLoadHostList(string name, string ip)
    {
        foreach (RectTransform chiled in HostTable)
        {
            Destroy(chiled.gameObject);
        }
        //后面再做列表=======================
        GameObject iteam   = AssetConfig.GetPrefabByName("HostBtnIteam");
        GameObject HostBtn = Instantiate(iteam);

        HostBtn.transform.SetParent(HostTable, true);
        HostBtn.GetComponent <UIHostItem>().Init(name, ip, this);
    }