public static LabelColors CreateFromJSON(string json) { LabelColors instance = JsonUtility.FromJson <LabelColors>(json); instance.Initialize(); return(instance); }
public void Initialize(Size size, LabelColors labelColors) { labelTemplate = transform.GetComponentInChildren <Label>(); labels = new List <Label>() { labelTemplate }; rect = GetComponent <RectTransform>(); this.labelColors = labelColors; SetSize(size); }
public void Initialize() { sizeConfig = GetComponent <SizeConfig>(); sizeConfig.RaiseResizeEvent += OnScreenResize; Size size = sizeConfig.Initialize(); texture = new Texture2D(size.Image.x, size.Image.y, TextureFormat.RGB24, false); cam = GameObject.FindObjectOfType <Cam>(); cam.Initialize(ref texture, size); monitor = GameObject.FindObjectOfType <Monitor>(); monitor.Initialize(size, LabelColors.CreateFromJSON(Resources.Load <TextAsset>("LabelColors").text)); clientManager = new ClientManager(ref texture); clientManager.RaiseDetectionEvent += OnDetection; }
public void Initialize() { _targetIndicatorObject = FindObjectsOfType <GameObject>().First(x => x.tag == "target"); _plane = FindObjectsOfType <GameObject>().First(x => x.tag == "plane"); sizeConfig = GetComponent <SizeConfig>(); sizeConfig.RaiseResizeEvent += OnScreenResize; Size size = sizeConfig.Initialize(); _size = size.Image; texture = new Texture2D(size.Image.x, size.Image.y, TextureFormat.RGB24, false); cam = GameObject.FindObjectOfType <Cam>(); cam.Initialize(ref texture, size); monitor = GameObject.FindObjectOfType <Monitor>(); monitor.Initialize(size, LabelColors.CreateFromJSON(Resources.Load <TextAsset>("LabelColors").text)); var hiResScreenShots = new HiResScreenShots(); clientManager = new ClientManager(hiResScreenShots); clientManager.RaiseDetectionEvent += OnDetection; }