private Resource LoadCubemap(ResourceInformation cubeInfo) { SharpDX.Toolkit.Graphics.TextureCube cube = SharpDX.Toolkit.Graphics.TextureCube.Load(device, cubeInfo.Filepath); SharpDX.Direct3D11.ShaderResourceView cubeView = new SharpDX.Direct3D11.ShaderResourceView(device, cube); return(new TextureCube(cube, cubeView)); }
public Resource Load(ResourceInformation info) { EffectCompiler compiler = new EffectCompiler(); EffectCompilerFlags flags = EffectCompilerFlags.None; if (enableDebug) { flags = EffectCompilerFlags.Debug | EffectCompilerFlags.OptimizationLevel0 | EffectCompilerFlags.SkipOptimization; } var effectResult = compiler.CompileFromFile(info.Filepath, flags); if (effectResult.HasErrors) { FearLog.Log("ERROR Compiling effect; " + info.Filepath, LogPriority.EXCEPTION); foreach (SharpDX.Toolkit.Diagnostics.LogMessage message in effectResult.Logger.Messages) { FearLog.Log("\t" + message.Text, LogPriority.EXCEPTION); } return(new FearMaterial()); } else { Effect effect = new Effect(device, effectResult.EffectData); effect.CurrentTechnique = effect.Techniques[info.GetString("Technique")]; FearMaterial mat = new FearMaterial(info.Name, effect); return(mat); } }
public Resource Load(ResourceInformation info) { if (info.GetBool("IsCubemap")) { return(LoadCubemap(info)); } SharpDX.Toolkit.Graphics.Texture2D texture = SharpDX.Toolkit.Graphics.Texture2D.Load(device, info.Filepath); SharpDX.Direct3D11.ShaderResourceView textureView; bool isLinearData = info.GetBool("IsLinear"); if (isLinearData) { textureView = new SharpDX.Direct3D11.ShaderResourceView(device, texture); } else { SharpDX.Direct3D11.ImageLoadInformation imageInfo = new SharpDX.Direct3D11.ImageLoadInformation(); imageInfo.BindFlags = SharpDX.Direct3D11.BindFlags.ShaderResource; imageInfo.Format = SharpDX.DXGI.Format.R8G8B8A8_UNorm_SRgb; imageInfo.Filter = SharpDX.Direct3D11.FilterFlags.SRgb | SharpDX.Direct3D11.FilterFlags.None; SharpDX.Direct3D11.Resource sRGBTexture = SharpDX.Direct3D11.Texture2D.FromFile(device, info.Filepath, imageInfo); textureView = new SharpDX.Direct3D11.ShaderResourceView(device, sRGBTexture); } Texture fearTexture = new Texture(texture, textureView); return(fearTexture); }
private void ExecuteTest(string patternConfiguration, string input, List <FoundMatchBase> expectedOutput, bool checkDefinition = false, bool cutBeginOfDefinition = false, bool cutEndOfDefinition = false) { NameValueCollection config = new NameValueCollection(); config.Add("formatString", patternConfiguration); if (checkDefinition) { config.Add("checkDefinition", "true"); } if (cutBeginOfDefinition) { config.Add("cutBeginOfDefinition", "true"); config.Add("beginOfDefinitionBoundaries", "unos,unas,una,un"); } if (cutEndOfDefinition) { config.Add("cutEndOfDefinition", "true"); } ResourceInformation inputResource = new ResourceInformation() { Content = input }; PatternTestAdapter <FormatStringPattern> ret = new PatternTestAdapter <FormatStringPattern>(config, inputResource, expectedOutput); ret.ExecuteTest(); }
public virtual void SetCharacterDisplayObject(int x, int y) { ThisDisplayObject = ResourceInformation.GetInstance(InstanceName, true); //ThisDisplayObject = UnityEngine.Object.Instantiate(ResourceInformation.CommonImage.transform.FindChild(InstanceName).gameObject, // ResourceInformation.DungeonDynamicObject.transform); ChangeDirection(Direction); SetPosition(x, y); }
private Resource LoadResource(string name, ResourceType type, ResourceInformation info) { Resource newResource = loaders[type].Load(info); if (newResource.IsLoaded()) { return(newResource); } throw new UnableToLoadResourceException(); }
bool ExistsID() { ResourceInformation find = Array.Find(gathering, x => x.ID == _ID.stringValue); if (!find) { return(false); //若没有找到,则ID可用 } //找到的对象不是原对象 或者 找到的对象是原对象且同ID超过一个 时为true return(find != info || (find == info && Array.FindAll(gathering, x => x.ID == _ID.stringValue).Length > 1)); }
private List <string> CreateFileEntryFromInfo(ResourceInformation info) { List <string> newEntry = new List <string>(); newEntry.Add(" <" + GetTypeString() + ">"); foreach (string key in info.InformationKeys) { newEntry.Add(" <" + key + ">" + info.GetString(key) + "</" + key + ">"); } newEntry.Add(" </" + GetTypeString() + ">"); return(newEntry); }
public ResourceInformation GetInformationByName(string name) { ResourceInformation info = defaultInfo; XmlTextReader xmlReader = SearchFileForResource(name); if (!xmlReader.EOF) { PopulateInformationFromXMLBlock(info, xmlReader); } return(info); }
internal PatternTestAdapter(NameValueCollection config, ResourceInformation input, List <FoundMatchBase> expectedOutput) { _pattern = Activator.CreateInstance <T>(); if (config != null) { NameValueConfigurationCollection properConfig = new NameValueConfigurationCollection(); foreach (string key in config.AllKeys) { properConfig.Add(new NameValueConfigurationElement(key, config[key])); } _pattern.Configure(properConfig); } _input = input; _expectedOutput = expectedOutput; }
public void UpdateDefaultInExistingResourceFile() { //Given ResourceFile outOfDateDefaultResourceFile = new MeshResourceFile(new XMLResourceStorage(GetResourceFolder(), "ResourceFileWithOutdatedDefault.xml", ResourceType.Material)); MaterialResourceInformation defaultInfo = new MaterialResourceInformation(); //When ResourceInformation updatedInformation = outOfDateDefaultResourceFile.GetResourceInformationByName("DEFAULT"); string updatedFilePath = updatedInformation.Filepath; //Then string originalFilePath = "C:\\ThisAddressShouldStayTheSame"; Assert.IsTrue(updatedFilePath.CompareTo(originalFilePath) == 0); Assert.IsTrue(updatedInformation.InformationKeys.Count == defaultInfo.InformationKeys.Count); }
private void OnEnable() { lineHeight = EditorGUIUtility.singleLineHeight; lineHeightSpace = lineHeight + 2; info = target as ResourceInformation; _ID = serializedObject.FindProperty("_ID"); _name = serializedObject.FindProperty("_name"); gatherType = serializedObject.FindProperty("gatherType"); gatherTime = serializedObject.FindProperty("gatherTime"); refreshTime = serializedObject.FindProperty("refreshTime"); lootPrefab = serializedObject.FindProperty("lootPrefab"); productItems = serializedObject.FindProperty("productItems"); dropList = new DropItemListDrawer(serializedObject, productItems, lineHeight, lineHeightSpace); gathering = Resources.LoadAll <ResourceInformation>("Configuration"); }
public XMLResourceStorage(string loc, string name, ResourceType t) { location = loc; filename = name; filePath = location + "\\" + filename; type = t; infoFactory = new ResourceInformationFactory(); defaultInfo = infoFactory.CreateResourceInformation(type); if (!System.IO.File.Exists(filePath)) { CreateFile(); } defaultInfo = GetInformationByName(defaultInfo.Name); StoreInformation(defaultInfo); }
public void StoreInformation(ResourceInformation information) { List <string> lines = GetFileLines(); RemoveEntryByName(lines, information.Name); List <string> newEntry = CreateFileEntryFromInfo(information); lines.InsertRange(2, newEntry); try { File.WriteAllLines(filePath, lines.ToArray()); } catch (Exception e) { FearLog.Log(e.Message, LogPriority.EXCEPTION); } }
private void PopulateInformationFromXMLBlock(ResourceInformation parsedInfo, XmlTextReader xmlReader) { string key = "Name"; string value = xmlReader.Value; parsedInfo.UpdateInformation(key, value); while (!ReachedEndOfResourceBlock(xmlReader)) { if (xmlReader.NodeType == XmlNodeType.Element && parsedInfo.InformationKeys.Contains(xmlReader.Name)) { key = xmlReader.Name; xmlReader.Read(); value = xmlReader.Value; parsedInfo.UpdateInformation(key, value); } xmlReader.Read(); } xmlReader.Close(); }
//public Dictionary<CharacterDirection, MapPoint> DeathBlowTargetPoint; //public Dictionary<CharacterDirection, BaseCharacter> DeathBlowTargetCharacter; //public AttackInformation DeathBlowInformation; /// <summary> /// オブジェクト初期化処理 /// </summary> public override void Initialize() { base.Initialize(); IsMapDisplay = true; Type = ObjectType.Player; ObjNo = PlayerInformation.Info.ObjNo; _isEndAnima = true; IsSatietyCaution = false; IsSatietyDanger = false; InstanceName = PlayerInformation.Info.InstanceName; //ThisDisplayObject = GameObject.Find(InstanceName); ThisDisplayObject = ResourceInformation.GetPlayerInstance(InstanceName); //ThisDisplayObject = this.gameObject; // ItemList = new Dictionary<Guid, BaseItem>(); ////item = TableItemIncidence.GetItemObjNo(ItemType.Food, 23004); ////AddItem(item, item.ObjNo); //item = TableItemIncidence.GetItemObjNo(ItemType.Candy, 24011); //AddItem(item, item.ObjNo); }
public override bool ForceEquip(BaseCharacter target) { //ClearAnalyse(); //インスタンスのコピーを作成 switch (ApType) { case ShieldAppearanceType.Podlit: ShieldObject = ResourceInformation.GetInstance("UnityEquipShieldPodlit", target.EquipLeft.transform); //ShieldObject = UnityEngine.Object.Instantiate(ResourceInformation.UnityEquip.transform.FindChild("UnityEquipShieldPodlit").gameObject); _ObjectVector = new Vector3(-0.022f, 0.059f, 0.042f); _ObjectQuaternion = new Quaternion(-0.211501f, 0.5699962f, 0.5806013f, -0.5415474f); break; case ShieldAppearanceType.Wood: ShieldObject = ResourceInformation.GetInstance("UnityEquipShieldWood", target.EquipLeft.transform); //ShieldObject = UnityEngine.Object.Instantiate(ResourceInformation.UnityEquip.transform.FindChild("UnityEquipShieldWood").gameObject); if (PlayerInformation.Info.PType == PlayerType.OricharChan) { _ObjectVector = new Vector3(-0.006f, 0.113f, -0.003f); _ObjectQuaternion = new Quaternion(0.7836433f, -0.07938863f, -0.2394273f, 0.567693f); } break; case ShieldAppearanceType.Paper: ShieldObject = ResourceInformation.GetInstance("UnityEquipShieldPaper", target.EquipLeft.transform); //ShieldObject = UnityEngine.Object.Instantiate(ResourceInformation.UnityEquip.transform.FindChild("UnityEquipShieldStars").gameObject); _ObjectVector = new Vector3(-0.057f, 0.057f, 0.005f); _ObjectQuaternion = new Quaternion(0.5535138f, 0.5570804f, 0.2628616f, 0.5605245f); break; case ShieldAppearanceType.Knight: ShieldObject = ResourceInformation.GetInstance("UnityEquipShieldKnight", target.EquipLeft.transform); //ShieldObject = UnityEngine.Object.Instantiate(ResourceInformation.UnityEquip.transform.FindChild("UnityEquipShieldKnight").gameObject); _ObjectVector = new Vector3(-0.057f, 0.057f, 0.005f); _ObjectQuaternion = new Quaternion(0.5535138f, 0.5570804f, 0.2628616f, 0.5605245f); break; case ShieldAppearanceType.Empire: ShieldObject = ResourceInformation.GetInstance("UnityEquipShieldEmpire", target.EquipLeft.transform); //ShieldObject = UnityEngine.Object.Instantiate(ResourceInformation.UnityEquip.transform.FindChild("UnityEquipShieldEmpire").gameObject); _ObjectVector = new Vector3(-0.057f, 0.057f, 0.005f); _ObjectQuaternion = new Quaternion(0.5535138f, 0.5570804f, 0.2628616f, 0.5605245f); break; case ShieldAppearanceType.Stars: ShieldObject = ResourceInformation.GetInstance("UnityEquipShieldStars", target.EquipLeft.transform); _ObjectVector = new Vector3(-0.022f, 0.059f, 0.042f); _ObjectQuaternion = new Quaternion(-0.211501f, 0.5699962f, 0.5806013f, -0.5415474f); break; } // 左手の子オブジェクトとして登録する //ShieldObject.transform.SetParent(target.EquipLeft.transform.transform); //位置を0クリア ShieldObject.transform.localPosition = ObjectVector; ShieldObject.transform.localRotation = ObjectQuaternion; //装備中にする IsEquip = true; ResetEquipOptionStatus(target); return(true); }
public void getData(List<string> Input_URIs) { //should be returned List<ResourceInformation> ResourceInformationList = new List<ResourceInformation>(); foreach (string item in Input_URIs) { //constructing the queries, we had to do FROM<dbpedia.org> to prevent garbage data, should be faster too string querySide1 = "SELECT * FROM <http://dbpedia.org> WHERE {<" + item + "> ?pred ?obj}"; string querySide2 = "SELECT * FROM <http://dbpedia.org> WHERE {?subj ?pred <" + item + ">}"; //doing both queries SparqlResultSet res1 = new SparqlResultSet(); SparqlResultSet res2 = new SparqlResultSet(); res1 = endpoint.QueryWithResultSet(querySide1); res2 = endpoint.QueryWithResultSet(querySide2); //Initialize the resource ResourceInformation temp = new ResourceInformation(); temp.predicates_resourceIsSubj = new List<KeyValuePair<string, string>>(); temp.resources_resourceIsSubj = new List<KeyValuePair<string, string>>(); temp.predicates_resourceIsObj = new List<KeyValuePair<string, string>>(); temp.resources_resourceIsObj = new List<KeyValuePair<string, string>>(); temp.rawComparisonObject = new List<KeyValuePair<KeyValuePair<string, string>, List<KeyValuePair<string, string>>>>(); temp.FinalComparisonObject = new List<KeyValuePair<KeyValuePair<string, string>, List<KeyValuePair<string, string>>>>(); temp.ID = new KeyValuePair<string, string>(); //Filling all the information in case <ourResourceID> ?x ?y foreach (SparqlResult item_res1 in res1) { //string tempo=getLabel(((LiteralNode)item_res1.Value("pred")).ToString()); if (String.Equals(((INode)(item_res1.Value("obj"))).GetType().Name.ToString(), "UriNode")) { temp.resources_resourceIsSubj.Add(new KeyValuePair<string, string>(item_res1.Value("obj").ToString(), getLabel(item_res1.Value("obj").ToString()))); } else { string onlyValue = ((LiteralNode)item_res1.Value("obj")).Value; temp.resources_resourceIsSubj.Add(new KeyValuePair<string, string>(item_res1.Value("obj").ToString(), onlyValue)); //To fill out the ID component if (String.Equals(item_res1.Value("pred").ToString(), "http://www.w3.org/2000/01/rdf-schema#label")) { temp.ID = new KeyValuePair<string, string>(item, temp.resources_resourceIsSubj[temp.resources_resourceIsSubj.Count - 1].Value); } } temp.predicates_resourceIsSubj.Add(new KeyValuePair<string, string>(item_res1.Value("pred").ToString(), getLabel(item_res1.Value("pred").ToString()))); } //Filling all the information in case ?x ?y <ourResourceID> foreach (SparqlResult item_res2 in res2) { //We add of to the name, child of .....etc temp.predicates_resourceIsObj.Add(new KeyValuePair<string, string>(item_res2.Value("pred").ToString(), getLabel(item_res2.Value("pred").ToString()) + " of")); if (String.Equals(((INode)(item_res2.Value("subj"))).GetType().Name.ToString(), "UriNode")) temp.resources_resourceIsObj.Add(new KeyValuePair<string, string>(item_res2.Value("subj").ToString(), getLabel(item_res2.Value("subj").ToString()))); else { string onlyValue = ((LiteralNode)item_res2.Value("subj")).Value; temp.resources_resourceIsSubj.Add(new KeyValuePair<string, string>(item_res2.Value("subj").ToString(), onlyValue)); } } //filling comparison component temp=fillComparisonComponent(temp); //Addding the resource to the list of resourceInformation Objects ResourceInformationList.Add(temp); //Copying it to the globalVariable ComparisonOutput = ResourceInformationList; } //getting common between URIs Console.WriteLine("getting Common"); ResourceInformationList=getCommon(ResourceInformationList); //logging logResults(ResourceInformationList); }
public void AddResource(ResourceInformation r) { Resources.Add(r); }
void HandlingStageList() { stageList = new ReorderableList(serializedObject, stages, false, true, true, true); stageList.drawElementCallback = (rect, index, isActive, isFocused) => { serializedObject.UpdateIfRequiredOrScript(); EditorGUI.BeginChangeCheck(); SerializedProperty cropStage = stages.GetArrayElementAtIndex(index); SerializedProperty lastingDays = cropStage.FindPropertyRelative("lastingDays"); SerializedProperty repeatTimes = cropStage.FindPropertyRelative("repeatTimes"); SerializedProperty indexToReturn = cropStage.FindPropertyRelative("indexToReturn"); SerializedProperty gatherInfo = cropStage.FindPropertyRelative("gatherInfo"); SerializedProperty graph = cropStage.FindPropertyRelative("graph"); string name = "[阶段" + index + "]"; switch (crop.Stages[index].Stage) { case CropStageType.Seed: name += "种子期"; break; case CropStageType.Seedling: name += "幼苗期"; break; case CropStageType.Growing: name += "成长期"; break; case CropStageType.Flowering: name += "开花期"; break; case CropStageType.Bearing: name += "结果期"; break; case CropStageType.Maturity: name += "成熟期"; break; case CropStageType.OverMature: name += "过熟期"; break; case CropStageType.Harvested: name += "收割期"; break; case CropStageType.Withered: name += "枯萎期"; break; case CropStageType.Decay: name += "腐朽期"; break; } EditorGUI.PropertyField(new Rect(rect.x + 8, rect.y, rect.width / 4 - 8, lineHeight), cropStage, new GUIContent(name)); EditorGUI.LabelField(new Rect(rect.x + rect.width - 166, rect.y, 30, lineHeight), "持续"); EditorGUI.PropertyField(new Rect(rect.x + rect.width - 138, rect.y, 26, lineHeight), lastingDays, new GUIContent(string.Empty)); if (lastingDays.intValue < 1) { if (index == stages.arraySize - 1) { lastingDays.intValue = -1; } else { lastingDays.intValue = 1; } } EditorGUI.LabelField(new Rect(rect.x + rect.width - 110, rect.y, 16, lineHeight), "天"); EditorGUI.LabelField(new Rect(rect.x + rect.width - 86, rect.y, 40, lineHeight), "可收割"); EditorGUI.PropertyField(new Rect(rect.x + rect.width - 46, rect.y, 26, lineHeight), repeatTimes, new GUIContent(string.Empty)); if (repeatTimes.intValue < 0) { repeatTimes.intValue = -1; } EditorGUI.LabelField(new Rect(rect.x + rect.width - 18, rect.y, 16, lineHeight), "次"); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } if (cropStage.isExpanded) { int lineCount = 1; serializedObject.UpdateIfRequiredOrScript(); EditorGUI.BeginChangeCheck(); graph.objectReferenceValue = EditorGUI.ObjectField(new Rect(rect.x - rect.width + lineHeight * 4.2f, rect.y + lineHeightSpace * lineCount, rect.width - 8, lineHeight * 3.2f), string.Empty, graph.objectReferenceValue, typeof(Sprite), false); if (repeatTimes.intValue != 0) { if (!gatherInfo.objectReferenceValue || gatherInfo.objectReferenceValue && !AssetDatabase.IsSubAsset(gatherInfo.objectReferenceValue)) { EditorGUI.PropertyField(new Rect(rect.x - 4 + lineHeight * 4.5f, rect.y + lineHeightSpace * lineCount, rect.width - lineHeight * 4f, lineHeight), gatherInfo, new GUIContent("对应采集物信息")); lineCount++; } else if (AssetDatabase.IsSubAsset(gatherInfo.objectReferenceValue)) { EditorGUI.LabelField(new Rect(rect.x - 4 + lineHeight * 4.5f, rect.y + lineHeightSpace * lineCount, rect.width - lineHeight * 4f, lineHeight), $"对应采集物信息{((gatherInfo.objectReferenceValue as ResourceInformation).IsValid ? string.Empty : "(未补全)")}"); lineCount++; } if (gatherInfo.objectReferenceValue) { if (GUI.Button(new Rect(rect.x - 4 + lineHeight * 4.5f, rect.y + lineHeightSpace * lineCount, rect.width - lineHeight * 4f, lineHeight), "编辑")) { EditorUtility.OpenPropertyEditor(gatherInfo.objectReferenceValue); } lineCount++; if (AssetDatabase.IsSubAsset(gatherInfo.objectReferenceValue)) { if (GUI.Button(new Rect(rect.x - 4 + lineHeight * 4.5f, rect.y + lineHeightSpace * lineCount, rect.width - lineHeight * 4f, lineHeight), "删除")) { AssetDatabase.RemoveObjectFromAsset(gatherInfo.objectReferenceValue); gatherInfo.objectReferenceValue = null; } lineCount++; } } else if (GUI.Button(new Rect(rect.x - 4 + lineHeight * 4.5f, rect.y + lineHeightSpace * lineCount, rect.width - lineHeight * 4f, lineHeight), "新建")) { ResourceInformation infoInstance = CreateInstance <ResourceInformation>(); infoInstance.SetBaseName("resource info"); AssetDatabase.AddObjectToAsset(infoInstance, target); gatherInfo.objectReferenceValue = infoInstance; SerializedObject gInfoObj = new SerializedObject(gatherInfo.objectReferenceValue); SerializedProperty _ID = gInfoObj.FindProperty("_ID"); SerializedProperty _name = gInfoObj.FindProperty("_name"); _ID.stringValue = this._ID.stringValue + "S" + index; _name.stringValue = this._name.stringValue; gInfoObj.ApplyModifiedProperties(); EditorUtility.OpenPropertyEditor(infoInstance); } lineCount++; } if ((repeatTimes.intValue < 0 || repeatTimes.intValue > 1) && index > 0) { lineCount = 4; EditorGUI.IntSlider(new Rect(rect.x + 8, rect.y + lineHeightSpace * lineCount, rect.width - 8, lineHeight), indexToReturn, 0, index - 1, new GUIContent("收割后返回阶段")); } if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } } }; stageList.elementHeightCallback = (index) => { int lineCount = 1; float listHeight = 0; SerializedProperty cropStage = stages.GetArrayElementAtIndex(index); SerializedProperty gatherInfo = cropStage.FindPropertyRelative("gatherInfo"); SerializedProperty repeatTimes = cropStage.FindPropertyRelative("repeatTimes"); if (cropStage.isExpanded) { lineCount += 3;//空白 if ((repeatTimes.intValue < 0 || repeatTimes.intValue > 1) && index > 0) { lineCount++; } } return(lineHeightSpace * lineCount + listHeight); }; stageList.onRemoveCallback = (list) => { if (crop.Stages.Count < 10) { serializedObject.UpdateIfRequiredOrScript(); EditorGUI.BeginChangeCheck(); if (EditorUtility.DisplayDialog("删除", "确定删除这个阶段吗?", "确定", "取消")) { serializedObject.FindProperty("stages").DeleteArrayElementAtIndex(list.index); } if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } } }; stageList.onAddDropdownCallback = (_rect, _list) => { GenericMenu menu = new GenericMenu(); if (!crop.Stages.Exists(s => s.Stage == CropStageType.Seed)) { menu.AddItem(new GUIContent("种子期"), false, OnAddOption, CropStageType.Seed); } if (!crop.Stages.Exists(s => s.Stage == CropStageType.Seedling)) { menu.AddItem(new GUIContent("幼苗期"), false, OnAddOption, CropStageType.Seedling); } if (!crop.Stages.Exists(s => s.Stage == CropStageType.Growing)) { menu.AddItem(new GUIContent("成长期"), false, OnAddOption, CropStageType.Growing); } if (!crop.Stages.Exists(s => s.Stage == CropStageType.Flowering)) { menu.AddItem(new GUIContent("开花期"), false, OnAddOption, CropStageType.Flowering); } if (!crop.Stages.Exists(s => s.Stage == CropStageType.Bearing)) { menu.AddItem(new GUIContent("结果期"), false, OnAddOption, CropStageType.Bearing); } if (!crop.Stages.Exists(s => s.Stage == CropStageType.Maturity)) { menu.AddItem(new GUIContent("成熟期"), false, OnAddOption, CropStageType.Maturity); } if (!crop.Stages.Exists(s => s.Stage == CropStageType.OverMature)) { menu.AddItem(new GUIContent("过熟期"), false, OnAddOption, CropStageType.OverMature); } if (!crop.Stages.Exists(s => s.Stage == CropStageType.Harvested)) { menu.AddItem(new GUIContent("收割期"), false, OnAddOption, CropStageType.Harvested); } if (!crop.Stages.Exists(s => s.Stage == CropStageType.Withered)) { menu.AddItem(new GUIContent("枯萎期"), false, OnAddOption, CropStageType.Withered); } if (!crop.Stages.Exists(s => s.Stage == CropStageType.Decay)) { menu.AddItem(new GUIContent("腐朽期"), false, OnAddOption, CropStageType.Decay); } menu.DropDown(_rect); void OnAddOption(object data) { var cropStage = (CropStageType)data; crop.Stages.Add(new CropStage(1, cropStage)); Dictionary <CropStage, CropStage> returnStages = new Dictionary <CropStage, CropStage>(); for (int i = 0; i < crop.Stages.Count; i++) { returnStages.Add(crop.Stages[i], crop.Stages[crop.Stages[i].IndexToReturn]); } crop.Stages.Sort((x, y) => { if (x.Stage < y.Stage) { return(-1); } else if (x.Stage > y.Stage) { return(1); } else { return(0); } }); serializedObject.UpdateIfRequiredOrScript(); EditorGUI.BeginChangeCheck(); foreach (var returnStage in returnStages) { SerializedProperty stage = stages.GetArrayElementAtIndex(crop.Stages.IndexOf(returnStage.Key)); stage.FindPropertyRelative("indexToReturn").intValue = crop.Stages.IndexOf(returnStage.Value); } if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } } }; stageList.drawHeaderCallback = (rect) => { EditorGUI.LabelField(rect, "阶段列表"); }; stageList.drawNoneElementCallback = (rect) => { EditorGUI.LabelField(rect, "空列表"); }; } string GetAutoID() { string newID = string.Empty; CropInformation[] crops = Resources.LoadAll <CropInformation>("Configuration"); for (int i = 1; i < 1000; i++) { newID = "CROP" + i.ToString().PadLeft(3, '0'); if (!Array.Exists(crops, x => x.ID == newID)) { break; } } return(newID); } bool ExistsID() { CropInformation[] crops = Resources.LoadAll <CropInformation>("Configuration"); CropInformation find = Array.Find(crops, x => x.ID == _ID.stringValue); if (!find) { return(false); //若没有找到,则ID可用 } //找到的对象不是原对象 或者 找到的对象是原对象且同ID超过一个 时为true return(find != crop || (find == crop && Array.FindAll(crops, x => x.ID == _ID.stringValue).Length > 1)); } }
public override bool ForceEquip(BaseCharacter target) { //ClearAnalyse(); //インスタンスのコピーを作成 switch (ApType) { case WeaponAppearanceType.Sword: WeaponObject = ResourceInformation.GetInstance("UnityEquipSword", target.EquipRight.transform); //UnityEngine.Object.Instantiate(ResourceInformation.UnityEquip.transform.FindChild("UnityEquipSword").gameObject); break; case WeaponAppearanceType.Staff: WeaponObject = ResourceInformation.GetInstance("UnityEquipStaff", target.EquipRight.transform); //WeaponObject = UnityEngine.Object.Instantiate(ResourceInformation.UnityEquip.transform.FindChild("UnityEquipStaff").gameObject); break; case WeaponAppearanceType.Knife: WeaponObject = ResourceInformation.GetInstance("UnityEquipKnife", target.EquipRight.transform); //WeaponObject = UnityEngine.Object.Instantiate(ResourceInformation.UnityEquip.transform.FindChild("UnityEquipKnife").gameObject); break; case WeaponAppearanceType.Axe: WeaponObject = ResourceInformation.GetInstance("UnityEquipAxe", target.EquipRight.transform); //WeaponObject = UnityEngine.Object.Instantiate(ResourceInformation.UnityEquip.transform.FindChild("UnityEquipAxe").gameObject); break; case WeaponAppearanceType.Mace: WeaponObject = ResourceInformation.GetInstance("UnityEquipMace", target.EquipRight.transform); //WeaponObject = UnityEngine.Object.Instantiate(ResourceInformation.UnityEquip.transform.FindChild("UnityEquipMace").gameObject); break; case WeaponAppearanceType.Bat: WeaponObject = ResourceInformation.GetInstance("UnityEquipBat", target.EquipRight.transform); //WeaponObject = UnityEngine.Object.Instantiate(ResourceInformation.UnityEquip.transform.FindChild("UnityEquipBat").gameObject); _ObjectVector = new Vector3(-0.013f, 0.097f, -0.012f); _ObjectQuaternion = new Quaternion(-0.5976952f, 0, 0, 0.8017235f); break; case WeaponAppearanceType.HockeyStick: WeaponObject = ResourceInformation.GetInstance("UnityEquipHockeyStick", target.EquipRight.transform); //WeaponObject = UnityEngine.Object.Instantiate(ResourceInformation.UnityEquip.transform.FindChild("UnityEquipHockeyStick").gameObject); _ObjectVector = new Vector3(-0.006f, 0.089f, -0.001f); _ObjectQuaternion = new Quaternion(-0.5015087f, 0.4965344f, -0.5312584f, -0.4687292f); break; case WeaponAppearanceType.Plunger: WeaponObject = ResourceInformation.GetInstance("UnityEquipPlunger", target.EquipRight.transform); //WeaponObject = UnityEngine.Object.Instantiate(ResourceInformation.UnityEquip.transform.FindChild("UnityEquipPlunger").gameObject); _ObjectVector = new Vector3(-0.011f, 0.092f, -0.011f); _ObjectQuaternion = new Quaternion(-0.0183135f, -0.7184151f, 0.6577789f, -0.2255467f); break; } // 右手の子オブジェクトとして登録する //WeaponObject.transform.SetParent(target.EquipRight.transform.transform); //位置を0クリア WeaponObject.transform.localPosition = ObjectVector; WeaponObject.transform.localRotation = ObjectQuaternion; //装備中にする IsEquip = true; ResetEquipOptionStatus(target); return(true); }
private ResourceInformation cleanContent(ResourceInformation dirtyContent) { if (_cleanContents) { try { // remove all the comments dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"<!--.*-->", string.Empty, RegexOptions.IgnoreCase | RegexOptions.Singleline, new TimeSpan(0, 0, 60)); // remove tables dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"\{\|.*\|\}", string.Empty, RegexOptions.IgnoreCase | RegexOptions.Singleline, new TimeSpan(0, 0, 60)); // remove all the references dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"<ref[^>]*>(?:[^<]*</ref>)?", string.Empty, RegexOptions.IgnoreCase | RegexOptions.Singleline, new TimeSpan(0, 0, 60)); // keep only the text for all the links not archives: dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"\[\[(?!" + _fileTag + @":)(?:[^\|\]]*\|)*(?<text>[^\]]*)\]\]", "${text}", RegexOptions.IgnoreCase | RegexOptions.Singleline, new TimeSpan(0, 0, 60)); // remove the rest of the links: dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"\[\[[^\]]*\]\]", string.Empty, RegexOptions.IgnoreCase | RegexOptions.Singleline, new TimeSpan(0, 0, 60)); // keep only the text for the textual quotes: dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"\{\{" + _quoteTag + @"\|(?<text>[^\}\|]*)(?:\|[^\}]*)*\}\}", "${text}", RegexOptions.IgnoreCase | RegexOptions.Singleline, new TimeSpan(0, 0, 60)); // delete the rest of the quotes: dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"\{\{" + _quoteTag + @"[^\|]*(?:\|[^\}]*)\}\}", string.Empty, RegexOptions.IgnoreCase | RegexOptions.Singleline, new TimeSpan(0, 0, 60)); // keep the text of the ord templates: dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"\{\{ord\|(?<text1>[^\|\}]*)(?:\|(?<text2>[^\}]*))?\}\}", "${text1}${text2}", RegexOptions.IgnoreCase | RegexOptions.Singleline, new TimeSpan(0, 0, 60)); // keep the text of the overline templates: dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"\{\{overline\|(?<text>[^\}]*)\}\}", "${text}", RegexOptions.IgnoreCase | RegexOptions.Singleline, new TimeSpan(0, 0, 60)); // keep the text of the generic lang templates: dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"\{\{lang\|[^\|]*\|(?<text>[^\}]*)\}\}", "${text}", RegexOptions.IgnoreCase | RegexOptions.Singleline, new TimeSpan(0, 0, 60)); // keep the text of the culture-specific lang templates: dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"\{\{lang\-[^\|]*\|(?<text>[^\}]*)\}\}", "${text}", RegexOptions.IgnoreCase | RegexOptions.Singleline, new TimeSpan(0, 0, 60)); // keep the text of the Commons links templates: dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"\{\{commons[^\|\}]*(?:\|(?<text>[^\|\}]*)(?:\|[^\}\|]*)*)?\}\}", "${text}", RegexOptions.IgnoreCase | RegexOptions.Singleline, new TimeSpan(0, 0, 60)); // keep the text of the news links templates: dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"\{\{iprnoticias[^\|\}]*(?:\|[^\|\}]*)?\|(?<text>[^\|\}]*)\}\}", "${text}", RegexOptions.IgnoreCase | RegexOptions.Singleline, new TimeSpan(0, 0, 60)); // remove the rest of templates dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"\{\{.*\}\}", string.Empty, RegexOptions.IgnoreCase | RegexOptions.Singleline, new TimeSpan(0, 0, 60)); // keep the text of the external links: dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"\[\w+:\/\/[\w@][\w.:@]+\/?[\w\.~?=%&#=\-:@/$,]*(?:\s+(?<text>[^\]]*))?\]", "${text}", RegexOptions.IgnoreCase | RegexOptions.Singleline, new TimeSpan(0, 0, 60)); // remove the URLs dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"\w+:\/\/[\w@][\w.:@]+\/?[\w\.~?=%&#=\-:@/$,]*", string.Empty, RegexOptions.IgnoreCase | RegexOptions.Singleline, new TimeSpan(0, 0, 60)); // keep just the text in the redirections: dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"#" + _redirectTag + @"\w*\s*(?<text>[^#\r]*)(?:#.*)?", "${text}", RegexOptions.IgnoreCase, new TimeSpan(0, 0, 60)); // reformat titles dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"=====\s*(?<text>[^\r=]*)\s*=====", "${text}", RegexOptions.IgnoreCase, new TimeSpan(0, 0, 60)); dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"====\s*(?<text>[^\r=]*)\s*====", "${text}", RegexOptions.IgnoreCase, new TimeSpan(0, 0, 60)); dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"===\s*(?<text>[^\r=]*)\s*===", "${text}", RegexOptions.IgnoreCase, new TimeSpan(0, 0, 60)); dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"==\s*(?<text>[^\r=]*)\s*==", "${text}", RegexOptions.IgnoreCase, new TimeSpan(0, 0, 60)); dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"=\s*(?<text>[^\r=]*)\s*=", "${text}", RegexOptions.IgnoreCase, new TimeSpan(0, 0, 60)); // remove triple quotes dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"'''", string.Empty, RegexOptions.IgnoreCase | RegexOptions.Singleline, new TimeSpan(0, 0, 60)); // remove double quotes dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"''", string.Empty, RegexOptions.IgnoreCase | RegexOptions.Singleline, new TimeSpan(0, 0, 60)); // remove latex mathfrak function keeping the text parameter dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"\\mathfrak\{(?<text>[^\}]+)\}", "${text}", RegexOptions.IgnoreCase | RegexOptions.Singleline, new TimeSpan(0, 0, 60)); // remove all html tags dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"\<\/?[^\>]+\>", string.Empty, RegexOptions.IgnoreCase | RegexOptions.Singleline, new TimeSpan(0, 0, 60)); // special characters dirtyContent.Content = Regex.Replace(dirtyContent.Content, @" ", " ", RegexOptions.IgnoreCase, new TimeSpan(0, 0, 60)); dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"—", "-", RegexOptions.IgnoreCase, new TimeSpan(0, 0, 60)); dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"&", "&", RegexOptions.IgnoreCase, new TimeSpan(0, 0, 60)); dirtyContent.Content = Regex.Replace(dirtyContent.Content, @">", ">", RegexOptions.IgnoreCase, new TimeSpan(0, 0, 60)); dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"<", "<", RegexOptions.IgnoreCase, new TimeSpan(0, 0, 60)); dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"⊕", "⊕", RegexOptions.IgnoreCase, new TimeSpan(0, 0, 60)); dirtyContent.Content = Regex.Replace(dirtyContent.Content, @"×", "×", RegexOptions.IgnoreCase, new TimeSpan(0, 0, 60)); } catch (Exception ex) { Debug.WriteLine("Error occurred cleaning the contents of the resource: {0}{1} * Resource Content: {2}", ex, Environment.NewLine, dirtyContent.Content); } } return(dirtyContent); }
public abstract IEnumerable <FoundMatchBase> FindMatches(ResourceInformation information);
public Resource Load(ResourceInformation info) { Mesh mesh = new Mesh(device, loader.Load(info.Filepath), vertBuffFactory); return(mesh); }
/// <summary> /// Fills The comparisonComponent of each Resource To compare /// </summary> /// <param name="input">Object to fill its rawComparisonObject</param> /// <returns>The same resource Again</returns> private ResourceInformation fillComparisonComponent(ResourceInformation input) { var q = from x in input.predicates_resourceIsSubj group x by x into g let count = g.Count() //orderby count descending select new { Value = g.Key, Count = count }; int counter = 0; foreach (var x in q) { List<KeyValuePair<string, string>> tempRes = new List<KeyValuePair<string, string>>(); KeyValuePair<KeyValuePair<string, string>, List<KeyValuePair<string, string>>> temp = new KeyValuePair<KeyValuePair<string, string>, List<KeyValuePair<string, string>>>(); KeyValuePair<string, string> predicates= new KeyValuePair<string, string>(); predicates = x.Value; for (int i = counter; i < counter+x.Count; i++) { tempRes.Add(input.resources_resourceIsSubj[i]); } temp = new KeyValuePair<KeyValuePair<string, string>, List<KeyValuePair<string, string>>>(predicates, tempRes); input.rawComparisonObject.Add(temp); //Console.WriteLine("Value: " + x.Value + " Count: " + x.Count); counter += x.Count; } ///////// var q2 = from x in input.predicates_resourceIsObj group x by x into g let count = g.Count() //orderby count descending select new { Value = g.Key, Count = count }; counter = 0; foreach (var x in q2) { List<KeyValuePair<string, string>> tempRes = new List<KeyValuePair<string, string>>(); KeyValuePair<KeyValuePair<string, string>, List<KeyValuePair<string, string>>> temp = new KeyValuePair<KeyValuePair<string, string>, List<KeyValuePair<string, string>>>(); KeyValuePair<string, string> predicates = new KeyValuePair<string, string>(); predicates = x.Value; for (int i = counter; i < counter + x.Count; i++) { tempRes.Add(input.resources_resourceIsObj[i]); } temp = new KeyValuePair<KeyValuePair<string, string>, List<KeyValuePair<string, string>>>(predicates, tempRes); input.rawComparisonObject.Add(temp); //Console.WriteLine("Value: " + x.Value + " Count: " + x.Count); } ///////// return input; }
public void Awake() { //Application.targetFrameRate = 30; //30FPSに設定 ResourceInformation.DungeonInit(); }
public override IEnumerable <FoundMatchBase> FindMatches(ResourceInformation information) { information.Content = StringTreatment.NormalizeText(information.Content); return(FindMatches(information.Content)); }