public void CreateJsonFile() { MainS pmain = new MainS { TopLeft = new float[] { center[0] - width / 2, center[1] - height / 2 }, BotRight = new float[] { center[0] + width / 2, center[1] + height / 2 } }; Alternative palter = new Alternative { Center = center, Width = width, Height = height }; EachPoint epoint1 = new EachPoint { Comment = "top-left, (x;y)", Point = new float[] { center[0] - width / 2, center[1] - height / 2 } }; EachPoint epoint2 = new EachPoint { Comment = "top-right, (x;y)", Point = new float[] { center[0] + width / 2, center[1] - height / 2 } }; EachPoint epoint3 = new EachPoint { Comment = "bottom-left, (x;y)", Point = new float[] { center[0] - width / 2, center[1] + height / 2 } }; EachPoint epoint4 = new EachPoint { Comment = "bottom-right, (x;y)", Point = new float[] { center[0] + width / 2, center[1] + height / 2 } }; Region pregion = new Region { Main = pmain, Alternative = palter, EachPoint = new EachPoint[] { epoint1, epoint2, epoint4, epoint3 } }; oldCoup o = new oldCoup { ImageName = name, Region = pregion }; string jsonData = JsonConvert.SerializeObject(o); File.WriteAllText(path + '/' + name + ".json", JsonConvert.SerializeObject(o)); }
public void updateFrom(MainS ms) { NUD_Dot_Size.NUDTextBox.Text = ms.dotSize.ToString(); CB_leftColor.SelectedItem = ms.leftColor.ToString(); CB_rightColor.SelectedItem = ms.rightColor.ToString(); ChB_ShowCoch.IsChecked = ms.showChart; CB_eventSize.SelectedItem = ms.eventSize; NUD_Dots_Per_Event.NUDTextBox.Text = ms.dotsToPaint.ToString(); CB_channels.SelectedItem = ms.channels; CB_mono_stereo.SelectedItem = ms.mono_stereo.ToString(); CB_screenSize.SelectedItem = ms.screenSize.ToString().Replace("s", string.Empty); this.InvalidateVisual(); }
void OnEnable() { mainSscript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <MainS>(); cra = GameObject.FindGameObjectWithTag("wayPoint").GetComponent <Createenemy>(); healthEnemy = cra.HealthEnemy; txtHealth.text = healthEnemy.ToString(); waypoints = mainSscript.waypoints; Transform parent = transform.parent; ParentPointShot = parent; waitTime = startWaitTime; wayPnt = 0; }
public MainS getFromForm() { MainS ms = new MainS(); bool error = false; if (CB_leftColor.SelectedItem == null || (CB_leftColor.SelectedItem.ToString() != EnumColor.BLACK.ToString() && CB_leftColor.SelectedItem.ToString() != EnumColor.BLUE.ToString() && CB_leftColor.SelectedItem.ToString() != EnumColor.BROWN.ToString() && CB_leftColor.SelectedItem.ToString() != EnumColor.GREEN.ToString() && CB_leftColor.SelectedItem.ToString() != EnumColor.MAGENTA.ToString() && CB_leftColor.SelectedItem.ToString() != EnumColor.ORANGE.ToString() && CB_leftColor.SelectedItem.ToString() != EnumColor.RED.ToString() && CB_leftColor.SelectedItem.ToString() != EnumColor.YELLOW.ToString())) { error = true; } if (CB_rightColor.SelectedItem == null || (CB_rightColor.SelectedItem.ToString() != EnumColor.BLACK.ToString() && CB_rightColor.SelectedItem.ToString() != EnumColor.BLUE.ToString() && CB_rightColor.SelectedItem.ToString() != EnumColor.BROWN.ToString() && CB_rightColor.SelectedItem.ToString() != EnumColor.GREEN.ToString() && CB_rightColor.SelectedItem.ToString() != EnumColor.MAGENTA.ToString() && CB_rightColor.SelectedItem.ToString() != EnumColor.ORANGE.ToString() && CB_rightColor.SelectedItem.ToString() != EnumColor.RED.ToString() && CB_rightColor.SelectedItem.ToString() != EnumColor.YELLOW.ToString())) { error = true; } if (CB_eventSize.SelectedItem == null || (Convert.ToInt16(CB_eventSize.SelectedItem) != 16 && Convert.ToInt16(CB_eventSize.SelectedItem) != 32)) { error = true; } if (CB_channels.SelectedItem == null || (Convert.ToInt16(CB_channels.SelectedItem) != 64 && Convert.ToInt16(CB_channels.SelectedItem) != 32 && Convert.ToInt16(CB_channels.SelectedItem) != 128 && Convert.ToInt16(CB_channels.SelectedItem) != 256)) { error = true; } if (CB_mono_stereo.SelectedItem == null || (CB_mono_stereo.SelectedItem.ToString() != EnumAudio.MONO.ToString() && CB_mono_stereo.SelectedItem.ToString() != EnumAudio.STEREO.ToString())) { error = true; } if (error == false) { ms.dotSize = Convert.ToInt16(NUD_Dot_Size.NUDTextBox.Text); ms.leftColor = (EnumColor)Enum.Parse(typeof(EnumColor), CB_leftColor.SelectedItem.ToString(), true); ms.rightColor = (EnumColor)Enum.Parse(typeof(EnumColor), CB_rightColor.SelectedItem.ToString(), true); ms.showChart = ChB_ShowCoch.IsChecked.Value; ms.eventSize = Convert.ToInt16(CB_eventSize.SelectedItem); ms.dotsToPaint = Convert.ToInt16(NUD_Dots_Per_Event.NUDTextBox.Text); ms.channels = Convert.ToInt16(CB_channels.SelectedItem); ms.mono_stereo = (EnumAudio)Enum.Parse(typeof(EnumAudio), CB_mono_stereo.SelectedItem.ToString(), true); ms.screenSize = (EnumScreenSize)Enum.Parse(typeof(EnumScreenSize), "s" + CB_screenSize.SelectedItem.ToString()); } return(ms); }
private void Start() { mainscript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <MainS>(); txtlvl.text = "LVL " + lvl.ToString(); }