private void init() { _targetMap.put(BuildTarget.StandaloneWindows, "windows"); _targetMap.put(BuildTarget.Android, "android"); _targetMap.put(BuildTarget.iOS, "ios"); _targetMap.put(BuildTarget.StandaloneOSX, "mac"); }
protected override void onAddItemNotice(SList <ItemData> list, int way) { SMap <string, object> param = new SMap <string, object>(); param.put("list", list); param.put("way", way); me.dispatch(GameEventType.AddItemNotice, param); }
private void OnEnable() { isInspectingPrefab = (PrefabUtility.GetPrefabType(base.target) == PrefabType.Prefab); animationName = serializedObject.FindProperty("_animationName"); center = serializedObject.FindProperty("offset"); size = serializedObject.FindProperty("size"); _target = (AnimationBoxCollider)base.target; _skeletonAnimation = _target.gameObject.GetComponent <SkeletonAnimation>(); if (_skeletonAnimation != null) { _skeletonData = _skeletonAnimation.SkeletonDataAsset.GetSkeletonData(true); var animations = _skeletonData.Animations; for (int i = 0; i < animations.Count; i++) { string name = animations.Items[i].Name; float duration = animations.Items[i].Duration; _frames.put(name, (int)Math.Round(duration * 30f) + 1); } } }
/// <summary> /// 获取影响组 /// </summary> public static bool[] getInfluenceSet(int[] arr) { string key = countKey(arr); bool[] re; if ((re = _resultDic.get(key)) == null) { re = new bool[SkillInfluenceType.size]; Array.Copy(_sample, 0, re, 0, re.Length); foreach (int v in arr) { if (v > 0) { re[v] = true; } else { re[-v] = false; } } _resultDic.put(key, re); } return(re); }
public static void make() { _uiElementDic.clear(); _uiModelDic.clear(); initElementNames(); foreach (var v in _elementPrefabDic) { Transform tf = v.transform; UIObjectData element = new UIObjectData(); element.name = tf.gameObject.name; element.type = UIElementType.Element; element.style = ""; if (tf.gameObject.tag.Equals("G")) { element.style = "G"; } makeNode(element, tf); _uiElementDic.put(element.name, element); } //生成新预处理列表 string[] files = FileUtils.getDeepFileList(ShineToolGlobal.uiModelsPath, "prefab"); for (int i = 0; i < files.Length; i++) { string assetsPath = ToolFileUtils.getAssetsPath(files[i]); GameObject prefab = AssetDatabase.LoadAssetAtPath <GameObject>(assetsPath); Transform tf = prefab.transform; UIObjectData element = new UIObjectData(); element.name = tf.gameObject.name; element.type = UIElementType.Model; element.style = ""; if (tf.gameObject.tag.Equals("G")) { element.style = "G"; } makeNode(element, tf); _uiModelDic.put(element.name, element); } writeBytes(); ToolFileUtils.executeServerTool("uiModel"); Ctrl.print("OK"); }
protected override void afterReadConfig() { base.afterReadConfig(); bindPointMap = new SMap <int, Vector3>(); for (int i = bindPoints.Length - 1; i >= 0; --i) { float[] tmp = bindPoints[i]; if (tmp.Length > 3) { bindPointMap.put((int)tmp[0], new Vector3(tmp[1], tmp[2], tmp[3])); } else if (tmp.Length > 2) { bindPointMap.put((int)tmp[0], new Vector3(tmp[1], tmp[2])); } } }
protected virtual void doShowScene() { _elementDic = _currentSceneData.elements; _elementDicByObj.clear(); _elementDic.forEachValue(v => { makeElementModel(v); if (v.gameObject != null) { _elementDicByObj.put(v.gameObject, v); } else { Ctrl.errorLog("不支持的单位类型", v.config.type); } }); }
// /** 设置服务器指令组 */ // public void setServerCmdSet(SSet<string> value) // { // if(value==null) // return; // // value.forEach(k=> // { // if(_cmdDic.contains(k) && !k.Equals("help")) // { // Ctrl.throwError("重复的gm指令(与服务器冲突):",k); // } // }); // } private void addCmdObj(string cmd, Obj obj) { if (_cmdDic.contains(cmd)) { Ctrl.throwError("重复的gm指令:" + cmd); return; } _cmdDic.put(cmd, obj); }
/** 读取bundle配置 */ private void readResourceInfoConfig() { string[][] re = ToolFileUtils.readFileForExcelFirstSheet(ShineToolGlobal.resourceInfoPath); _defaultSaveType = int.Parse(re[0][1]); _signedResourceSaveDic = new SMap <string, int>(); for (int i = 2; i < re.Length; i++) { _signedResourceSaveDic.put(re[i][0], int.Parse(re[i][1])); } }
/** 执行添加方法 */ public void toAddMethod(ILMethodInfo method) { string key = method.getKey(); //不重复添加 if (methodKeys.contains(key)) { return; } methods.add(method); methodKeys.put(key, method); }
/** 加载文件记录 */ public void read(bool allClear) { _isAllClear = allClear; _dic.clear(); _lastSet.clear(); //allClear不读 if (File.Exists(_path) && !_isAllClear) { XML xml = FileUtils.readFileForXML(_path); String oldVersion = xml.getProperty("version"); //版本对 if (oldVersion.Equals(_version)) { foreach (XML xl in xml.getChildrenByName("info")) { FileRecordData data = new FileRecordData(); data.lastModified = Convert.ToInt64(xl.getProperty("lastModified")); data.length = Convert.ToInt64(xl.getProperty("length")); data.md5 = xl.getProperty("md5"); data.ex = xl.getProperty("ex"); data.ex2 = xl.getProperty("ex2"); data.ex3 = xl.getProperty("ex3"); data.ex4 = xl.getProperty("ex4"); _dic.put(xl.getProperty("path"), data); _lastSet.add(xl.getProperty("path")); _isNew = false; } } } }
private static void initElementNames() { _elementDic = new SMap <string, string>(); _elementPrefabDic = new SMap <string, GameObject>(); string[] files = FileUtils.getDeepFileList(ShineToolGlobal.uiElementsPath, "prefab"); for (int i = 0; i < files.Length; i++) { string assetsPath = ToolFileUtils.getAssetsPath(files[i]); GameObject prefab = AssetDatabase.LoadAssetAtPath <GameObject>(assetsPath); _elementDic.put(assetsPath, prefab.name); _elementPrefabDic.put(assetsPath, prefab); } }
public virtual void readBytes(BytesReadStream stream) { appVersion = stream.readInt(); // leastAppVersion=stream.readInt(); resourceVersion = stream.readInt(); // leastResourceVersion=stream.readInt(); version = stream.readUTF(); isRelease = stream.readBoolean(); int len = stream.readLen(); ResourceSaveData sData; for (int i = 0; i < len; i++) { sData = createBundleSaveData(); sData.readBytes(stream); resourceDic.put(sData.name, sData); } }
private void makeGridShow(int x, int z, int v) { GameObject grid = GameObject.Instantiate(_gridAsset); grid.transform.SetParent(_wallLayer.transform); Vector3 vec = grid.transform.position; vec.y = 0.01f; setVectorByGrid(ref vec, x, z); grid.transform.position = vec; GGridComponent component = grid.GetComponent <GGridComponent>(); component.setChangeFunc(onGridChanged); component.x = x; component.z = z; component.type = v; GSceneElementEditorData eData = new GSceneElementEditorData(); eData.component = component; eData.gameObject = grid; eData.canPick = false; _gridShows[x, z] = eData; _gridShowsDicByObj.put(grid, eData); GameObject go = createGridShow(v); if (go != null) { go.transform.SetParent(grid.transform); go.transform.localPosition = Vector3.zero; eData.childObj = go; } }
/// <summary> /// 生成UI预制 /// </summary> /// <param name="force">是否强制全部生成(如果否,则增量生成,只生成改变量)</param> public static void make(bool force = false) { EditorUtility.DisplayProgressBar("请耐心等待", "正在抽离UI预制体...", 0.0f); /** 需要处理的预制体列表 */ SMap <string, long> generateList = new SMap <string, long>(); /** 全部预处理列表(包含当前所有的预制体修改记录,用于生成记录文件) */ SMap <string, long> allGenerateList = new SMap <string, long>(); if (!Directory.Exists(ShineToolGlobal.uiModelsPath)) { Directory.CreateDirectory(ShineToolGlobal.uiModelsPath); } if (!Directory.Exists(ShineToolGlobal.uiGenerateModelsPath)) { Directory.CreateDirectory(ShineToolGlobal.uiGenerateModelsPath); force = true; } //生成新预处理列表 string[] files = FileUtils.getDeepFileList(ShineToolGlobal.uiModelsPath, "prefab"); int pathLen = ShineToolGlobal.gamePath.Length + 1; for (int i = 0; i < files.Length; i++) { string file = files[i]; long time = File.GetLastWriteTime(file).Ticks; file = file.Substring(pathLen); generateList.put(file, time); allGenerateList.put(file, time); } //读取旧预处理列表 BytesReadStream stream = FileUtils.readFileForBytesReadStream(ShineToolGlobal.uiRecordPath); //读取旧预处理列表 if (force || stream == null || !stream.checkVersion(ShineToolGlobal.uiRecordVersion)) { FileUtils.clearDir(ShineToolGlobal.uiGenerateModelsPath); } else { /** 旧预处理列表 */ SMap <string, long> oldGenerateList = new SMap <string, long>(); int len = stream.readInt(); for (int i = 0; i < len; ++i) { oldGenerateList[stream.readUTF()] = stream.readLong(); } //比较新旧预制列表,并删除无效预制 oldGenerateList.forEach((k, v) => { long newTime; string genPath = ShineToolGlobal.uiGenerateModelsPath + "/"; if (generateList.tryGetValue(k, out newTime)) //如果新列表里有 { if (newTime == oldGenerateList[k]) //如果未修改,则不用抽离 { generateList.remove(k); } else //如果已修改 { File.Delete(genPath + Path.GetFileName(k)); } } else //新列表里没有,说明已删除 { File.Delete(genPath + Path.GetFileName(k)); } }); } //生成UI预制 int progressNum = generateList.length() + 1; int curNum = 0; generateList.forEach((k, v) => { generateUIPrefab(k); ++curNum; EditorUtility.DisplayProgressBar("请耐心等待", "正在抽离UI预制体...", (float)curNum / progressNum); }); //写入记录 BytesWriteStream buffer = new BytesWriteStream(); buffer.writeVersion(ShineToolGlobal.uiRecordVersion); buffer.writeInt(allGenerateList.Count); allGenerateList.forEach((k, v) => { buffer.writeUTF(k); buffer.writeLong(allGenerateList[k]); }); FileUtils.writeFileForBytes(ShineToolGlobal.uiRecordPath, buffer); EditorUtility.ClearProgressBar(); }
/// <summary> /// 复制(深拷贝) /// </summary> protected override void toCopy(BaseData data) { if (!(data is KeepSaveData)) { return; } KeepSaveData mData = (KeepSaveData)data; if (mData.booleanDic != null) { if (this.booleanDic != null) { this.booleanDic.clear(); this.booleanDic.ensureCapacity(mData.booleanDic.size()); } else { this.booleanDic = new IntBooleanMap(mData.booleanDic.size()); } IntBooleanMap booleanDicT = this.booleanDic; if (!mData.booleanDic.isEmpty()) { int booleanDicKFreeValue = mData.booleanDic.getFreeValue(); int[] booleanDicKKeys = mData.booleanDic.getKeys(); bool[] booleanDicVValues = mData.booleanDic.getValues(); for (int booleanDicKI = booleanDicKKeys.Length - 1; booleanDicKI >= 0; --booleanDicKI) { int booleanDicK = booleanDicKKeys[booleanDicKI]; if (booleanDicK != booleanDicKFreeValue) { bool booleanDicV = booleanDicVValues[booleanDicKI]; int booleanDicW; bool booleanDicU; booleanDicW = booleanDicK; booleanDicU = booleanDicV; booleanDicT.put(booleanDicW, booleanDicU); } } } } else { this.booleanDic = null; nullObjError("booleanDic"); } if (mData.intDic != null) { if (this.intDic != null) { this.intDic.clear(); this.intDic.ensureCapacity(mData.intDic.size()); } else { this.intDic = new IntIntMap(mData.intDic.size()); } IntIntMap intDicT = this.intDic; if (!mData.intDic.isEmpty()) { int intDicKFreeValue = mData.intDic.getFreeValue(); int[] intDicKKeys = mData.intDic.getKeys(); int[] intDicVValues = mData.intDic.getValues(); for (int intDicKI = intDicKKeys.Length - 1; intDicKI >= 0; --intDicKI) { int intDicK = intDicKKeys[intDicKI]; if (intDicK != intDicKFreeValue) { int intDicV = intDicVValues[intDicKI]; int intDicW; int intDicU; intDicW = intDicK; intDicU = intDicV; intDicT.put(intDicW, intDicU); } } } } else { this.intDic = null; nullObjError("intDic"); } if (mData.longDic != null) { if (this.longDic != null) { this.longDic.clear(); this.longDic.ensureCapacity(mData.longDic.size()); } else { this.longDic = new IntLongMap(mData.longDic.size()); } IntLongMap longDicT = this.longDic; if (!mData.longDic.isEmpty()) { int longDicKFreeValue = mData.longDic.getFreeValue(); int[] longDicKKeys = mData.longDic.getKeys(); long[] longDicVValues = mData.longDic.getValues(); for (int longDicKI = longDicKKeys.Length - 1; longDicKI >= 0; --longDicKI) { int longDicK = longDicKKeys[longDicKI]; if (longDicK != longDicKFreeValue) { long longDicV = longDicVValues[longDicKI]; int longDicW; long longDicU; longDicW = longDicK; longDicU = longDicV; longDicT.put(longDicW, longDicU); } } } } else { this.longDic = null; nullObjError("longDic"); } if (mData.stringDic != null) { if (this.stringDic != null) { this.stringDic.clear(); this.stringDic.ensureCapacity(mData.stringDic.size()); } else { this.stringDic = new SMap <string, string>(mData.stringDic.size()); } SMap <string, string> stringDicT = this.stringDic; if (!mData.stringDic.isEmpty()) { string[] stringDicKKeys = mData.stringDic.getKeys(); string[] stringDicVValues = mData.stringDic.getValues(); for (int stringDicKI = stringDicKKeys.Length - 1; stringDicKI >= 0; --stringDicKI) { string stringDicK = stringDicKKeys[stringDicKI]; if (stringDicK != null) { string stringDicV = stringDicVValues[stringDicKI]; string stringDicW; string stringDicU; stringDicW = stringDicK; stringDicU = stringDicV; stringDicT.put(stringDicW, stringDicU); } } } } else { this.stringDic = null; nullObjError("stringDic"); } }
/// <summary> /// 读取字节流(完整版) /// </summary> protected override void toReadBytesFull(BytesReadStream stream) { stream.startReadObj(); int booleanDicLen = stream.readLen(); if (this.booleanDic != null) { this.booleanDic.clear(); this.booleanDic.ensureCapacity(booleanDicLen); } else { this.booleanDic = new IntBooleanMap(booleanDicLen); } IntBooleanMap booleanDicT = this.booleanDic; for (int booleanDicI = booleanDicLen - 1; booleanDicI >= 0; --booleanDicI) { int booleanDicK; bool booleanDicV; booleanDicK = stream.readInt(); booleanDicV = stream.readBoolean(); booleanDicT.put(booleanDicK, booleanDicV); } int intDicLen = stream.readLen(); if (this.intDic != null) { this.intDic.clear(); this.intDic.ensureCapacity(intDicLen); } else { this.intDic = new IntIntMap(intDicLen); } IntIntMap intDicT = this.intDic; for (int intDicI = intDicLen - 1; intDicI >= 0; --intDicI) { int intDicK; int intDicV; intDicK = stream.readInt(); intDicV = stream.readInt(); intDicT.put(intDicK, intDicV); } int longDicLen = stream.readLen(); if (this.longDic != null) { this.longDic.clear(); this.longDic.ensureCapacity(longDicLen); } else { this.longDic = new IntLongMap(longDicLen); } IntLongMap longDicT = this.longDic; for (int longDicI = longDicLen - 1; longDicI >= 0; --longDicI) { int longDicK; long longDicV; longDicK = stream.readInt(); longDicV = stream.readLong(); longDicT.put(longDicK, longDicV); } int stringDicLen = stream.readLen(); if (this.stringDic != null) { this.stringDic.clear(); this.stringDic.ensureCapacity(stringDicLen); } else { this.stringDic = new SMap <string, string>(stringDicLen); } SMap <string, string> stringDicT = this.stringDic; for (int stringDicI = stringDicLen - 1; stringDicI >= 0; --stringDicI) { string stringDicK; string stringDicV; stringDicK = stream.readUTF(); stringDicV = stream.readUTF(); stringDicT.put(stringDicK, stringDicV); } stream.endReadObj(); }
protected void registChild(UIObject child) { _childrenDic.put(child.name, child); child.setParent(this); }
/// <summary> /// map添加 /// </summary> public void func_MapPut(TriggerExecutor e, TriggerArg a, SMap <object, object> map, object key, object value) { map.put(key, value); }