/// <summary> /// 初始化所有UI容器 /// </summary> public void InitUIType() { //初始化所有UIType容器 List <UITypeEnum> listUIType = EnumExtension.GetEnumValue <UITypeEnum>(); foreach (var itemData in listUIType) { GetUITypeContainer(itemData); } }
public ResultJson(ResultCode code, string message = null) { this.api_version = "v1"; this.code = EnumExtension.GetEnumValue(typeof(ResultCode), code.ToString()); this.success = true; if (string.IsNullOrEmpty(message)) { this.message = EnumExtension.GetEnumDesc(typeof(ResultCode), code.ToString()); } if (code != ResultCode.OK) { this.success = false; } }
/// <summary> /// 注册所有方块 /// </summary> public void RegisterBlock() { List <BlockTypeEnum> listBlockType = EnumExtension.GetEnumValue <BlockTypeEnum>(); for (int i = 0; i < listBlockType.Count; i++) { BlockTypeEnum blockType = listBlockType[i]; //获取方块数据 BlockInfoBean blockInfo = GetBlockInfo(blockType); string blockTypeName = EnumExtension.GetEnumName(blockType); //通过反射获取类 Block block = ReflexUtil.CreateInstance <Block>($"BlockType{blockTypeName}"); if (block == null) { block = new Block(); } block.SetData(blockType); block.blockInfo = blockInfo; arrayBlockRegister[(int)blockType] = block; } }
/// <summary> /// 初始化意图 /// </summary> /// <typeparam name="I"></typeparam> public virtual void InitIntent <E>() where E : System.Enum { List <E> listIntent = EnumExtension.GetEnumValue <E>(); for (int i = 0; i < listIntent.Count; i++) { E itemIntent = listIntent[i]; string intentName = itemIntent.GetEnumName(); string classNameTitle = itemIntent.GetType().Name.Replace("Enum", ""); string className = $"{classNameTitle}{intentName}"; //首先获取类池里面是否有这个意图 if (!dicIntentPool.TryGetValue(className, out AIBaseIntent intentClass)) { intentClass = ReflexUtil.CreateInstance <AIBaseIntent>(className); } if (intentClass != null) { intentClass.InitData(itemIntent, this); AddIntent(intentClass); } } }