private static void ParseWd(ToolConfig cfg, string swtch, string args) { if (swtch == "-wd") { cfg.WorkDir = args; } }
/// <summary> /// 窗体加载时执行 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void F_Main_Load(object sender, EventArgs e) { // 绑定复选框 string IsTop = ToolConfig.GetAppSetting("IsTop"); string IsLog = ToolConfig.GetAppSetting("IsLog"); cb_IsTop.Checked = IsTop != "0"; cb_Log.Checked = IsLog != "0"; TopMost = cb_IsTop.Checked; string name = "T:"; // 绑定类的信息 BindCom( cmb_Class, _assembly.GetTypes(), c => c.BaseType == typeof(BaseFun),// 父类是BaseFun c => new ComBoxItem() { Display = GetNote(name + c.FullName, ""), Value = c.FullName }); // 绑定数据库列表 BindCom( cmb_Database, ToolConfig.GetConList(), c => true, c => new ComBoxItem() { Display = c, Value = c }); }
// // Private Methods // private RectTransform CreatePanel(ToolConfig config) { var toolPanel = Instantiate(config.panelPrefab, toolsPanel, false); toolPanel.SetActive(false); toolPanel.name = config.label + "Panel"; return(toolPanel.GetComponent <RectTransform>()); }
private Button CreateButton(ToolConfig config, Transform panel, bool enabled) { var button = Instantiate(buttonPrefab, panel, false).GetComponent <Button>(); button.image.sprite = config.icon; button.interactable = enabled; button.GetComponentInChildren <Text>().text = Translator.Get(config.label); return(button); }
static void Main() { //设置默认字体 DevExpress.Utils.AppearanceObject.DefaultFont = new System.Drawing.Font("微软雅黑", 9); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(ToolConfig.GetAppSetting("SkinName").IfNullOrWhitespace("Office 2019")); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FrmMain()); }
/// <summary> /// 按钮单击时执行,执行选中的指定方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bt_Exec_Click(object sender, EventArgs e) { List <object> list = new List <object>(); // 循环方法的所有参数 foreach (var item in selMethod.GetParameters()) { // 寻找和参数名称相同的控件 Control con = flp_Para.Controls.Find(item.Name, false).FirstOrDefault(); object obj = null; #region 参数校验 if (con == null) { MessageBox.Show($"缺少参数:{item.Name}"); return; } if (string.IsNullOrWhiteSpace(con.Text)) { MessageBox.Show($"{item.Name}:值为空"); return; } try { obj = Convert.ChangeType(con.Text, item.ParameterType); } catch (Exception) { MessageBox.Show($"{item.Name}:类型错误 ({item.ParameterType.Name})"); return; } #endregion list.Add(obj); } // 构造函数的参数 object[] paramArr = new object[] { DBHelper.GetDbContent(ToolConfig.GetConStr(cmb_Database.SelectedValue + "")) }; Result res = (Result)selMethod.Invoke(_assembly.CreateInstance(selType.FullName, true, BindingFlags.Default, null, paramArr, null, null), list.ToArray()); if (cb_Log.Checked) { res.Msg += $"\n{selType.Name}\t{selMethod.Name}\t运行时间:{res.RunTime} ms\n"; MessageBox.Show(res.Msg); } }
private void Button_Click_1(object sender, RoutedEventArgs e) { //test binding on another thread ToolConfig tc = new ToolConfig(); MySynchronizationContext ctx = new MySynchronizationContext(this.Dispatcher); DataBinder.AddCompiledBinding(tc, "DefaultPath", tDefault, "Tool.AssemblyPath", ctx); ThreadPool.QueueUserWorkItem(delegate { tc.DefaultPath = "my test default"; }); }
// // Private Methods // private void AddTool(ToolConfig toolConfig, bool enabled) { var toolInfo = new ToolInfo(); tools.Add(toolInfo); toolInfo.toolConfig = toolConfig; toolInfo.button = CreateButton(toolConfig, toolsListPanel.transform, enabled); if (enabled) { toolInfo.button.onClick.AddListener(delegate { OnToolButtonClick(toolInfo); }); toolInfo.panel = CreatePanel(toolConfig); } }
private Button CreateButton(ToolConfig config, Transform panel, bool enabled) { var sButton = Instantiate(buttonPrefab, panel, false); var button = sButton.GetComponentInChildren <Button>(); button.image.sprite = config.icon; button.interactable = enabled; sButton.GetComponentInChildren <Text>().text = config.label; if (!enabled) { sButton.GetComponentInChildren <Text>().color = button.colors.disabledColor; } return(button); }
public ToolConfigUC() { _tool = new ToolConfig(); InitializeComponent(); Binding b = new Binding("Tool.AssemblyPath"); b.Source = this; b.Mode = BindingMode.TwoWay; wt.SetBinding(TextBox.TextProperty, b); //b = new Binding("Tool.DefaultPath"); //b.Source = this; //b.Mode = BindingMode.TwoWay; //wt.SetBinding(WatermarkedTextBox.WatermarkProperty, b); }
private static void ParseCp(ToolConfig cfg, bool isCp, string swtch, string args) { if (swtch == "-cp") { int addcp = (isCp) ? 1 : 0; string[] cps = args.Split(';'); cfg.ClassPath = new ClassPath[cps.Length + addcp]; for (int i = 0; i < cps.Length; i++) { cfg.ClassPath[i] = new ClassPath() { Path = cps[i] }; } } }
private static void ParseDl(ToolConfig cfg, bool isDll, string swtch, string args) { if (swtch == "-dp") { int adddp = isDll ? 1 : 0; string[] dps = args.Split(';'); cfg.AssemblyReference = new AssemblyReference[dps.Length + adddp]; for (int i = 0; i < dps.Length; i++) { cfg.AssemblyReference[i] = new AssemblyReference() { Assembly = dps[i] }; } } }
public static void ReadXmlConfigs() { // CurrentToolConfig = XMLHelper.ReadXmlConfig<ToolConfig>(@"..\..\..\Common\ToolConfigs\Evatec\ToolConfig.xml"); // CurrentSystemConfig = XMLHelper.ReadXmlConfig<SystemConfig>(@"..\..\..\Common\ToolConfigs\SystemConfig.xml"); // Mike - config files will always be here on release build string toolConfigFilePath = @"\config\"; string systemConfigFilePath = @"\config\"; #if DEBUG1 toolConfigFilePath = @"..\..\..\Common\ToolConfigs\Evatec\"; systemConfigFilePath = @"..\..\..\Common\ToolConfigs\"; #endif CurrentToolConfig = XMLHelper.ReadXmlConfig <ToolConfig>(toolConfigFilePath + ToolConfigFile); CurrentSystemConfig = XMLHelper.ReadXmlConfig <SystemConfig>(systemConfigFilePath + SystemConfigFile); }
void OnDestroy() { if (currentBrush != null) { var configAsset = AssetDatabase.LoadAssetAtPath <ToolConfig> ("Assets/Editor/Config.asset"); if (configAsset == null) { conf = ScriptableObject.CreateInstance <ToolConfig> (); conf.CurrentBrush = currentBrush; AssetDatabase.CreateAsset(conf, "Assets/Editor/Config.asset"); } else { configAsset.CurrentBrush = currentBrush; AssetDatabase.SaveAssets(); } } }
static void ConfigureLogging() { try { string log4netpath = ToolConfig.GetUnityPlasticLogConfigFile(); if (!File.Exists(log4netpath)) { WriteLogConfiguration.For(log4netpath); } XmlConfigurator.Configure(new FileInfo(log4netpath)); } catch { //it failed configuring the logging info; nothing to do. } }
private void DoTools() { ToolConfig toolConfig = _config.Tools; _tools = new ITool[] { new AxeTool(toolConfig.Axe), new FertilizerTool(toolConfig.Fertilizer), new GrassStarterTool(toolConfig.GrassStarter), new HoeTool(toolConfig.Hoe), new PickaxeTool(toolConfig.Pickaxe), new ScytheTool(toolConfig.Scythe), new SeedTool(toolConfig.Seeds), new WateringCanTool(toolConfig.WateringCan), new ShearTool(), new MilkPailTool() }; }
static void ConfigureLogging(string botName) { if (string.IsNullOrEmpty(botName)) { botName = DateTime.Now.ToString("yyyy_MM_dd_HH_mm"); } try { string log4netpath = ToolConfig.GetLogConfigFile(); log4net.GlobalContext.Properties["Name"] = botName; XmlConfigurator.Configure(new FileInfo(log4netpath)); } catch { //it failed configuring the logging info; nothing to do. } }
public override void InitTask() { var player = CreatePlayer(); var toolConfig = new ToolConfig(typeof(LayoutTool), new ToolParams()); player.SetupParams(new PlayerParameters(new Vector3(0, 0, -1050), Vector3.zero, SceneParametersContainer.PlayerSpeed, 20, sceneInfo: "Social interactions", isVR: SceneParametersContainer.IsVR, toolConfigs: new[] { toolConfig })); { var graph = new GameObject("Social interactions"); var graphControler = graph.AddComponent <GraphForBillboardVertexes>(); Graphs.Add(graphControler); var edges = new List <AdjacencyListBaseGenerator.AdjacencyInfo>(5000); const int vertCount = 500; const int sibCount = 10; const int enemyCount = 2; for (var i = 0; i < vertCount; ++i) { for (var j = 0; j < Random.Range(0, sibCount + 1); ++j) { var sibId = Random.Range(0, vertCount); while (sibId == i) { sibId = Random.Range(0, vertCount); } edges.Add(new AdjacencyListBaseGenerator.AdjacencyInfo(i.ToString(), sibId.ToString(), true, 100, 10, Color.blue)); } for (var j = 0; j < Random.Range(0, enemyCount + 1); ++j) { var sibId = Random.Range(0, vertCount); while (sibId == i) { sibId = Random.Range(0, vertCount); } edges.Add(new AdjacencyListBaseGenerator.AdjacencyInfo(i.ToString(), sibId.ToString(), true, 1000, 15, Color.red)); } } graphControler.SetupParams(new GraphParameters(Vector3.zero, "Social interactions")); var generator = new AdjacencyListBaseGenerator(edges, new RandomPlaceholder(Vector3.one * -2300, Vector3.one * 2300), null, 15); generator.Generate(graphControler); } }
private void HarvestAction() { //check if tool is enable from config ToolConfig ConfigForCurrentTool = new ToolConfig(""); foreach (ToolConfig TC in ModConfig.tool) { if (Game1.player.CurrentTool.name.Contains("Scythe")) { ConfigForCurrentTool = TC; break; } } if (ConfigForCurrentTool.name == "") { return; } int effectRadius = ConfigForCurrentTool.effectRadius; List <Vector2> affectedTileGrid = MakeVector2TileGrid(Game1.player.getTileLocation(), effectRadius); //harvesting objects foreach (Vector2 tile in affectedTileGrid) { StardewValley.Object anObject; if (Game1.currentLocation.objects.TryGetValue(tile, out anObject)) { if (anObject.isSpawnedObject) { if (anObject.isForage(Game1.currentLocation)) { bool gatherer = CheckFarmerProfession(Game1.player, SFarmer.gatherer); bool botanist = CheckFarmerProfession(Game1.player, SFarmer.botanist); if (botanist) { anObject.quality = 4; } if (gatherer) { int num = new Random().Next(0, 100); if (num < 20) { anObject.stack *= 2; } } } for (int i = 0; i < anObject.stack; i++) { Game1.currentLocation.debris.Add(new Debris(anObject, new Vector2(tile.X * Game1.tileSize, tile.Y * Game1.tileSize))); } Game1.currentLocation.removeObject(tile, false); continue; } if (anObject.name.ToLower().Contains("weed")) { Game1.createObjectDebris(771, (int)tile.X, (int)tile.Y, -1, 0, 1f, Game1.currentLocation); //fiber if (new Random().Next(0, 10) < 1) //10% mixed seeds { Game1.createObjectDebris(770, (int)tile.X, (int)tile.Y, -1, 0, 1f, Game1.currentLocation); //fiber } Game1.currentLocation.removeObject(tile, false); continue; } } } //harvesting plants foreach (Vector2 tile in affectedTileGrid) { TerrainFeature terrainTile; if (Game1.currentLocation.terrainFeatures.TryGetValue(tile, out terrainTile)) { if (Game1.currentLocation.terrainFeatures[tile] is HoeDirt) { HoeDirt hoedirtTile = (HoeDirt)Game1.currentLocation.terrainFeatures[tile]; if (hoedirtTile.crop == null) { continue; } int harvestMethod = hoedirtTile.crop.harvestMethod; hoedirtTile.crop.harvestMethod = Crop.sickleHarvest; if (hoedirtTile.crop.whichForageCrop == 1) //spring onion { StardewValley.Object anObject = new StardewValley.Object(399, 1); bool gatherer = CheckFarmerProfession(Game1.player, SFarmer.gatherer); bool botanist = CheckFarmerProfession(Game1.player, SFarmer.botanist); if (botanist) { anObject.quality = 4; } if (gatherer) { int num = new Random().Next(0, 100); if (num < 20) { anObject.stack *= 2; } } for (int i = 0; i < anObject.stack; i++) { Game1.currentLocation.debris.Add(new Debris(anObject, new Vector2(tile.X * Game1.tileSize, tile.Y * Game1.tileSize))); } hoedirtTile.destroyCrop(tile, true); continue; } if (hoedirtTile.crop.harvest((int)tile.X, (int)tile.Y, hoedirtTile)) { if (hoedirtTile.crop.indexOfHarvest == 421) //sun flower { int seedDrop = new Random().Next(1, 4); for (int i = 0; i < seedDrop; i++) { Game1.createObjectDebris(431, (int)tile.X, (int)tile.Y, -1, 0, 1f, Game1.currentLocation); //spawn sunflower seeds } } if (hoedirtTile.crop.regrowAfterHarvest == -1) { hoedirtTile.destroyCrop(tile, true); } } if (hoedirtTile.crop != null) { hoedirtTile.crop.harvestMethod = harvestMethod; } continue; } if (Game1.currentLocation.terrainFeatures[tile] is FruitTree) { FruitTree tree = (FruitTree)Game1.currentLocation.terrainFeatures[tile]; tree.shake(tile, false); continue; } //will test once I have giantcrop /* * if(Game1.currentLocation.terrainFeatures[tile] is GiantCrop) * { * GiantCrop bigCrop = (GiantCrop)Game1.currentLocation.terrainFeatures[tile]; * bigCrop.performToolAction((Tool)new Axe(), 100, tile); * continue; * } */ if (Game1.currentLocation.terrainFeatures[tile] is Grass) { Grass grass = (Grass)Game1.currentLocation.terrainFeatures[tile]; grass = null; Game1.currentLocation.terrainFeatures.Remove(tile); Farm.tryToAddHay(2); continue; } if (Game1.currentLocation.terrainFeatures[tile] is Tree) { continue; } } } }
private void ToolAction() { Tool currentTool = Game1.player.CurrentTool; //check if tool is enable from config ToolConfig ConfigForCurrentTool = new ToolConfig(""); foreach (ToolConfig TC in ModConfig.tool) { if (currentTool.name.Contains(TC.name)) { ConfigForCurrentTool = TC; break; } } if (ConfigForCurrentTool.name == "") { return; } else if (currentTool.upgradeLevel < ConfigForCurrentTool.minLevel) { return; } if (ConfigForCurrentTool.activeEveryTickAmount > 1) { ConfigForCurrentTool.incrementActiveCount(); if (ConfigForCurrentTool.canToolBeActive() == false) { return; } } int effectRadius = ConfigForCurrentTool.effectRadius; int currentWater = 0; if (currentTool is WateringCan) { WateringCan currentWaterCan = (WateringCan)currentTool; currentWater = currentWaterCan.WaterLeft; } float currentStamina = Game1.player.stamina; List <Vector2> affectedTileGrid = MakeVector2TileGrid(Game1.player.getTileLocation(), effectRadius); //if player on horse Vector2 currentMountPosition = new Vector2(); if (Game1.player.isRidingHorse()) { currentMountPosition = Game1.player.getMount().position; Game1.player.getMount().position = new Vector2(0, 0); } //Tool //before tool use int toolUpgrade = currentTool.upgradeLevel; currentTool.upgradeLevel = 4; Game1.player.toolPower = 0; //tool use foreach (Vector2 tile in affectedTileGrid) { currentTool.DoFunction(Game1.currentLocation, (int)(tile.X * Game1.tileSize), (int)(tile.Y * Game1.tileSize), 0, Game1.player); } //after tool use if (Game1.player.isRidingHorse()) { Game1.player.getMount().position = currentMountPosition; } currentTool.upgradeLevel = toolUpgrade; Game1.player.stamina = currentStamina; if (currentTool is WateringCan) { WateringCan currentWaterCan = (WateringCan)currentTool; currentWaterCan.WaterLeft = currentWater; } }
private static int Work(string[] args) { ToolConfig cfg; string mainEntry = args[0]; string ext = Path.GetExtension(mainEntry).ToLowerInvariant(); string workDir = null; string clr = null; string jvm = null; if (ext == ".xml") { var ser = new XmlSerializer(typeof(ToolConfig)); using (var reader = new FileStream(mainEntry, FileMode.Open)) { cfg = ser.Deserialize(reader) as ToolConfig; } } else { bool isDll = ext == ".dll"; bool isCp = ext == ".jar" || Directory.Exists(mainEntry); if (isDll || isCp) { cfg = new ToolConfig(); workDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); for (int i = 1; i < args.Length; i++) { if (args.Length > i + 1) { ParseWd(ref workDir, args[i], args[i + 1]); ParseCp(mainEntry, cfg, isCp, args[i], args[i + 1]); ParseDl(mainEntry, cfg, isDll, args[i], args[i + 1]); } } if (isDll) { if (cfg.AssemblyReference == null) { cfg.AssemblyReference = new AssemblyReference[1]; } cfg.AssemblyReference[cfg.AssemblyReference.Length - 1] = new AssemblyReference() { Assembly = mainEntry, Generate = true }; } if (isCp) { if (cfg.ClassPath == null) { cfg.ClassPath = new ClassPath[1]; } cfg.ClassPath[cfg.ClassPath.Length - 1] = new ClassPath() { Path = mainEntry, Generate = true }; } Directory.CreateDirectory(workDir); clr = Path.Combine(workDir, "clr"); jvm = Path.Combine(workDir, "jvm"); Directory.CreateDirectory(clr); Directory.CreateDirectory(jvm); cfg.TargetDirClr = clr; cfg.TargetDirJvm = jvm; } else { return(-1); } } Generator.config = cfg; Repository.config = cfg; Repository.Register(); Repository.Analyze(); Generator.GenerateAll(); Console.WriteLine("proxygen done"); if (workDir != null) { string fname = Path.GetFileNameWithoutExtension(mainEntry); WriteBuild(workDir, jvm, fname); var ser = new XmlSerializer(typeof(ToolConfig)); using (var fs = new FileStream(Path.Combine(workDir, fname + ".proxygen.xml"), FileMode.Create)) { using (XmlWriter xw = XmlWriter.Create(fs, new XmlWriterSettings { Indent = true })) { ser.Serialize(xw, cfg); } } } return(0); }
private Tool GetTool() { ICursorPosition c = Helper.Input.GetCursorPosition(); Vector2[] grid = GetGrid(c.Tile, _config.ToolRadius).ToArray(); Tool t = new Hoe(); GameLocation location = Game1.player.currentLocation; ToolConfig toolConfig = _config.Tools; //FarmAnimal animal; foreach (Vector2 tile in grid) { location.objects.TryGetValue(tile, out SObject tileObj); location.terrainFeatures.TryGetValue(tile, out TerrainFeature tileFeature); //animal = GetAnimal(location, tile); //Check tiles to see if they're objects. Weed, Twig, Stone type stuff if (tileObj != null) { if (tileObj.Name.Contains("Weed") || tileObj.Name.Contains("Twig")) { t = new Axe() { UpgradeLevel = _config.ToolLevel } } ; if (tileObj.Name.Contains("Stone")) { t = new Pickaxe() { UpgradeLevel = _config.ToolLevel } } ; } //Check tiles to see if they're terrainFeatures. Tree, HoeDirt type stuff if (tileFeature != null) { if (tileFeature is Tree) { t = new Axe() { UpgradeLevel = _config.ToolLevel } } ; if (tileFeature is HoeDirt dirt && dirt.crop == null || (Game1.player.ActiveObject != null && Game1.player.CurrentItem.Category != SObject.SeedsCategory && Game1.player.CurrentItem.Category != -19)) { t = new Pickaxe() { UpgradeLevel = _config.ToolLevel } } ; if (tileFeature is HoeDirt dirt1 && dirt1.crop != null) { t = new WateringCan() { UpgradeLevel = _config.ToolLevel } } ; if (tileFeature is Grass grass) { t = new MeleeWeapon() { Name = "Scythe", UpgradeLevel = _config.ToolLevel } } ; if (tileFeature is HoeDirt dirt3 && dirt3.crop == null && Game1.player.ActiveObject != null && (Game1.player.CurrentItem.Category == SObject.SeedsCategory || Game1.player.CurrentItem.Category == -19)) { bool planted; if (Game1.player.ActiveObject.Category == -19) { planted = dirt3.plant(Game1.player.ActiveObject.ParentSheetIndex, (int)tile.X, (int)tile.Y, Game1.player, true, location); if (planted) { Game1.player.reduceActiveItemByOne(); } } if (Game1.player.ActiveObject.Category == SObject.SeedsCategory) { planted = dirt3.plant(Game1.player.ActiveObject.ParentSheetIndex, (int)tile.X, (int)tile.Y, Game1.player, false, location); if (planted) { Game1.player.reduceActiveItemByOne(); } } } } /* * //See if Animal is not null * if (animal != null) * { * if (animal.toolUsedForHarvest.Value.Contains("ears")) * t = new Shears(){ UpgradeLevel = _config.ToolLevel }; * else * t = new MilkPail(){ UpgradeLevel = _config.ToolLevel }; * }*/ } return(t); }
public static void ReadXmlConfigs() { CurrentToolConfig = XMLHelper.ReadXmlConfig <ToolConfig>(@"Evatec\ToolConfig.xml"); CurrentSystemConfig = XMLHelper.ReadXmlConfig <SystemConfig>("SystemConfig.xml"); }
public override void InitTask() { var player = CreatePlayer(); var toolConfig = new ToolConfig(typeof(ClickTool), new ClickToolParams()); player.SetupParams(new PlayerParameters(new Vector3(0, 0, -50), Vector3.zero, SceneParametersContainer.PlayerSpeed, sceneInfo: "Hub scene", isVR: SceneParametersContainer.IsVR, toolConfigs: new[] { toolConfig })); //ToDo : Replace with auto generation var customFont = FontsGenerator.GetOrCreateFont("Arial", 128); var textTextureFactory = new TextTextureFactory(customFont, 0); { var graph = new GameObject("Tutorial tasks"); var graphControler = graph.AddComponent <GraphForBillboardVertexes>(); graphControler.ColliderEnable = false; Graphs.Add(graphControler); var baseScale = Vector2.one; graphControler.SetupParams(new GraphParameters(new Vector3(-20, 0, 0), "Tutorial tasks")); var text = textTextureFactory.MakeTextTexture("Tools test", true); var mainTexture = Texture2DExtension.ResizeTexture(Resources.Load <Texture2D>(_mainTexture), 400, 400); var imageParameters = new BillboardParameters(mainTexture, Vector4.zero, new Vector2(9, 2), useCache: true); var textParameters = new BillboardParameters(text, Vector4.zero, new Vector2(4, 0.4f), useCache: false, isMonoColor: true, monoColor: Color.white); var vertexParameters = new BillboardVertexParameters(new[] { imageParameters, textParameters }, new Vector3(-30, 18, 0)); var toolsTest = graphControler.SpawnVertex <BillboardVertex, BillboardVertexParameters>(vertexParameters); toolsTest.gameObject.AddComponent <Button3D>().Action = (gameObject) => SceneLoader.Instance.LoadScene <ToolTestTasks>(); text = textTextureFactory.MakeTextTexture("Movement test", true); textParameters = new BillboardParameters(text, Vector4.zero, new Vector2(4, 0.4f), isMonoColor: true, monoColor: Color.white, useCache: false); vertexParameters = new BillboardVertexParameters(new[] { imageParameters, textParameters }, new Vector3(-20, 9, 0)); var movementTest = graphControler.SpawnVertex <BillboardVertex, BillboardVertexParameters>(vertexParameters); movementTest.gameObject.AddComponent <Button3D>().Action = (gameObject) => SceneLoader.Instance.LoadScene <MovementTestTask>(); movementTest.Link <StretchableEdge, StretchableEdgeParameters>(toolsTest, new StretchableEdgeParameters(new StretchableEdgeMaterialParameters(Color.green), new SpringParameters(1, 5))); } { var graph = new GameObject("Beautiful scenes"); var graphControler = graph.AddComponent <GraphForBillboardVertexes>(); graphControler.ColliderEnable = false; Graphs.Add(graphControler); var baseScale = Vector2.one; graphControler.SetupParams(new GraphParameters(new Vector3(20, 0, 0), "Beautiful scenes")); var text = textTextureFactory.MakeTextTexture("Plants Kingdom", true); var mainTexture = Texture2DExtension.ResizeTexture(Resources.Load <Texture2D>(_mainTexture), 400, 400); var imageParameters = new BillboardParameters(mainTexture, Vector4.zero, new Vector2(9, 2), useCache: true); var textParameters = new BillboardParameters(text, Vector4.zero, new Vector2(4, 0.4f), useCache: false, isMonoColor: true, monoColor: Color.white); var vertexParameters = new BillboardVertexParameters(new[] { imageParameters, textParameters }, new Vector3(10, 10, 0)); var v1 = graphControler.SpawnVertex <BillboardVertex, BillboardVertexParameters>(vertexParameters); v1.gameObject.AddComponent <Button3D>().Action = (gameObject) => SceneLoader.Instance.LoadScene <PlantsKingdom>(); text = textTextureFactory.MakeTextTexture("Social graph 1", true); textParameters = new BillboardParameters(text, Vector4.zero, new Vector2(4, 0.4f), isMonoColor: true, monoColor: Color.white, useCache: false); vertexParameters = new BillboardVertexParameters(new[] { imageParameters, textParameters }, new Vector3(30, 19, 0)); var v2 = graphControler.SpawnVertex <BillboardVertex, BillboardVertexParameters>(vertexParameters); v2.gameObject.AddComponent <Button3D>().Action = (gameObject) => SceneLoader.Instance.LoadScene <OneGroupEnemyAndFriendsScene>(); text = textTextureFactory.MakeTextTexture("Social graph 2", true); textParameters = new BillboardParameters(text, Vector4.zero, new Vector2(4, 0.4f), isMonoColor: true, monoColor: Color.white, useCache: false); vertexParameters = new BillboardVertexParameters(new[] { imageParameters, textParameters }, new Vector3(20, 28, 0)); var v3 = graphControler.SpawnVertex <BillboardVertex, BillboardVertexParameters>(vertexParameters); v3.gameObject.AddComponent <Button3D>().Action = (gameObject) => SceneLoader.Instance.LoadScene <MultyGroupFriendsScene>(); v1.Link <StretchableEdge, StretchableEdgeParameters>(v2, new StretchableEdgeParameters(new StretchableEdgeMaterialParameters(Color.green), new SpringParameters(1, 5))); v2.Link <StretchableEdge, StretchableEdgeParameters>(v1, new StretchableEdgeParameters(new StretchableEdgeMaterialParameters(Color.green), new SpringParameters(1, 5))); v1.Link <StretchableEdge, StretchableEdgeParameters>(v3, new StretchableEdgeParameters(new StretchableEdgeMaterialParameters(Color.green), new SpringParameters(1, 5))); v3.Link <StretchableEdge, StretchableEdgeParameters>(v1, new StretchableEdgeParameters(new StretchableEdgeMaterialParameters(Color.green), new SpringParameters(1, 5))); v2.Link <StretchableEdge, StretchableEdgeParameters>(v3, new StretchableEdgeParameters(new StretchableEdgeMaterialParameters(Color.green), new SpringParameters(1, 5))); v3.Link <StretchableEdge, StretchableEdgeParameters>(v2, new StretchableEdgeParameters(new StretchableEdgeMaterialParameters(Color.green), new SpringParameters(1, 5))); } }
static int Main(string[] args) { string botName = null; try { MultilinerBotArguments botArgs = new MultilinerBotArguments(args); bool bValidArgs = botArgs.Parse(); botName = botArgs.BotName; ConfigureLogging(botName); mLog.InfoFormat("MultilinerBot [{0}] started. Version [{1}]", botName, System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); string argsStr = args == null ? string.Empty : string.Join(" ", args); mLog.DebugFormat("Args: [{0}]. Are valid args?: [{1}]", argsStr, bValidArgs); if (!bValidArgs || botArgs.ShowUsage) { PrintUsage(); if (botArgs.ShowUsage) { mLog.InfoFormat( "MultilinerBot [{0}] is going to finish: " + "user explicitly requested to show usage.", botName); return(0); } mLog.ErrorFormat( "MultilinerBot [{0}] is going to finish: " + "invalid arguments found in command line.", botName); return(0); } string errorMessage = null; if (!MultilinerBotArgumentsChecker.CheckArguments( botArgs, out errorMessage)) { Console.WriteLine(errorMessage); mLog.ErrorFormat( "MultilinerBot [{0}] is going to finish: error found on arguments check", botName); mLog.Error(errorMessage); return(1); } MultilinerBotConfiguration botConfig = MultilinerBotConfiguration. BuidFromConfigFile(botArgs.ConfigFilePath); errorMessage = null; if (!MultilinerBotConfigurationChecker.CheckConfiguration( botConfig, out errorMessage)) { Console.WriteLine(errorMessage); mLog.ErrorFormat( "MultilinerBot [{0}] is going to finish: error found on configuration check", botName); mLog.Error(errorMessage); return(1); } ConfigureServicePoint(); string escapedBotName = GetEscapedBotName(botName); LaunchMultilinerMergebot( botArgs.WebSocketUrl, botArgs.RestApiUrl, botConfig, ToolConfig.GetBranchesFile(escapedBotName), ToolConfig.GetCodeReviewsFile(escapedBotName), botName, botArgs.ApiKey); mLog.InfoFormat( "MultilinerBot [{0}] is going to finish: orderly shutdown.", botName); return(0); } catch (Exception e) { Console.WriteLine(e.Message); mLog.FatalFormat( "MultilinerBot [{0}] is going to finish: uncaught exception " + "thrown during execution. Message: {1}", botName, e.Message); mLog.DebugFormat("Stack trace:{0}{1}", Environment.NewLine, e.StackTrace); return(1); } }
static void Default_StyleChanged(object sender, EventArgs e) { string skinName = DevExpress.LookAndFeel.UserLookAndFeel.Default.ActiveSkinName; ToolConfig.SetAppSetting("SkinName", skinName); }
private void cb_IsTop_CheckedChanged(object sender, EventArgs e) { // 设置为顶层窗体 TopMost = cb_IsTop.Checked; ToolConfig.SetAppSetting("IsTop", cb_IsTop.Checked ? 1 : 0); }
private void cb_Log_CheckedChanged(object sender, EventArgs e) { ToolConfig.SetAppSetting("IsLog", cb_Log.Checked ? 1 : 0); }
private static int Work(string[] args) { foreach (String arg in args) { if (arg == "-debug") { Console.WriteLine("Execution in Debug Mode Started, Waiting for key press, Please attach to process now."); Console.ReadKey(); } } ToolConfig cfg; string mainEntry = args[0]; string ext = Path.GetExtension(mainEntry).ToLowerInvariant(); if (ext == ".xml") { var ser = new XmlSerializer(typeof(ToolConfig)); using (var reader = new FileStream(mainEntry, FileMode.Open)) { cfg = ser.Deserialize(reader) as ToolConfig; } } else { bool isDll = ext == ".dll"; bool isCp = ext == ".jar" || Directory.Exists(mainEntry); if (isDll || isCp) { cfg = new ToolConfig(); //workDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); for (int i = 1; i < args.Length; i++) { if (args.Length > i + 1) { ParseWd(cfg, args[i], args[i + 1]); ParseCp(cfg, isCp, args[i], args[i + 1]); ParseDl(cfg, isDll, args[i], args[i + 1]); } } if (isDll) { if (cfg.AssemblyReference == null) { cfg.AssemblyReference = new AssemblyReference[1]; } cfg.AssemblyReference[cfg.AssemblyReference.Length - 1] = new AssemblyReference() { Assembly = mainEntry, Generate = true }; } if (isCp) { if (cfg.ClassPath == null) { cfg.ClassPath = new ClassPath[1]; } cfg.ClassPath[cfg.ClassPath.Length - 1] = new ClassPath() { Path = mainEntry, Generate = true }; } } else { return(-1); } } //Create Folders if (String.IsNullOrEmpty(cfg.WorkDir)) { cfg.WorkDir = "work"; } if (String.IsNullOrEmpty(cfg.TargetDirClr)) { cfg.TargetDirClr = Path.Combine(cfg.WorkDir, "clr"); } if (String.IsNullOrEmpty(cfg.TargetDirJvm)) { cfg.TargetDirJvm = Path.Combine(cfg.WorkDir, "jvm");; } Directory.CreateDirectory(cfg.WorkDir); Directory.CreateDirectory(cfg.TargetDirClr); Directory.CreateDirectory(cfg.TargetDirJvm); Generator.config = cfg; Repository.config = cfg; Repository.Register(); Repository.Analyze(); Generator.GenerateAll(); Console.WriteLine("proxygen done"); if (cfg.WorkDir != null) { string fname = Path.GetFileNameWithoutExtension(mainEntry); WriteBuild(cfg.WorkDir, cfg.TargetDirJvm, fname); var ser = new XmlSerializer(typeof(ToolConfig)); using (var fs = new FileStream(Path.Combine(cfg.WorkDir, fname + ".proxygen.xml"), FileMode.Create)) { using (XmlWriter xw = XmlWriter.Create(fs, new XmlWriterSettings { Indent = true })) { ser.Serialize(xw, cfg); } } } return(0); }
public void AddTool(ToolConfig toolConfig) { AddTool(toolConfig, true); }