internal void setup(Transform follow, Hero.Data data, Hero.State state) { _text.text = data.ip + "\n" + data.name; id_ = data.id; if (state == Hero.State.Joined) { this._state = State.Joined; } else if (state == Hero.State.Ready) { this._state = State.Ready; } refresh(); if (_objRender != null) { UIRenderManager.Instance.destroy(_objRender); _objRender = null; } _objRender = UIRenderManager.Instance.create(data.platform.ToString()); _objRender.follow = follow; _renderImage.texture = _objRender.renderTexture; //_renderImage.rectTransform.sizeDelta _renderImage.SetNativeSize(); }
public ObjectRender create(string type) { ObjectRender objRender = null; Debug.Log("ContainsKey:" + type); if (pool_.ContainsKey(type)) { Debug.Log(pool_[type].Count); if (pool_[type].Count != 0) { objRender = pool_[type].Pop(); } Debug.Log(pool_[type].Count); } if (objRender == null && dictionary_.ContainsKey(type)) { objRender = dictionary_[type].create(); } // objRender.size = if (objRender != null) { objRender.type = type; objRender.open(); } //objRender.refresh(); return(objRender); // return null; }
public ObjectRender create() { GameObject obj = new GameObject("RenderOffset"); obj.transform.SetParent(this.transform); ObjectRender or = obj.AddComponent <ObjectRender>(); or.setup(_target); return(or); }
public void destroy(ObjectRender objRender) { if (objRender != null) { string type = objRender.type; if (!pool_.ContainsKey(type)) { pool_[type] = new Stack <ObjectRender>(); } objRender.close(); pool_[type].Push(objRender); Debug.Log("push:" + type); } }
public void setup(DeviceInfo info) { _text.text = info.ip + "\n" + info.title; id_ = info.id; this.name = "UI@" + info.title; if (_objRender != null) { UIRenderManager.Instance.destroy(_objRender); _objRender = null; } _objRender = UIRenderManager.Instance.create(info.platform.ToString()); Debug.Log(_objRender); Debug.Log(info); _objRender.follow = info.follow; _renderImage.texture = _objRender.renderTexture; //_renderImage.SetNativeSize(); _renderImage.rectTransform.sizeDelta = new Vector2(160f, 160f); _renderImage.rectTransform.localPosition = Vector3.zero; switch (info.state) { case DeviceInfo.State.Joined: _button.enabled = false; _plane.color = _joinedColor; _renderImage.gameObject.hide(); _image.gameObject.show(); break; case DeviceInfo.State.Ready: _renderImage.gameObject.show(); _image.gameObject.hide(); if (info.selected) { _button.enabled = false; _plane.color = _selectedColor; } else { _button.enabled = true; _plane.color = _readyColor; } break; } }