public override void OnInspectorGUI() { // render public fields of ChainHead base.OnInspectorGUI(); // retrive target and cast it to proper type var head = (ChainHead)this.target; // render the inpsector view var view = new ChainHeadView( new ChainHeadModel(head.GetVariableBindings()) ); view.OnAddBinding += this.OnAddBinding; view.OnClearAllBindings += this.OnClearAllBindings; view.OnEditBinding += this.OnEditBinding; view.OnProcess += this.OnProcess; view.OnRemoveBinding += this.OnRemoveBinding; view.Draw(); // remove all marked variables for (var i = 0; i < this.removeList.Count; ++i) { head.RemoveVariable(this.removeList[i]); } this.removeList.Clear(); // tell unity to redraw the inspector, values have changed if (GUI.changed) { EditorUtility.SetDirty(this.target); } }
public override IEnumerator DestroyLater() { yield return(new WaitForSeconds(3)); chainHead = null; game.NoteViews.Remove(note.id); Destroy(gameObject); if (chainRenderer != null) { Destroy(chainRenderer.gameObject); } }
protected override void OnDisplay() { base.OnDisplay(); ringSpriteRenderer.enabled = false; if (!initializedChainHead && note.isChainHead && chainHead == null) { initializedChainHead = true; chainHead = Instantiate(chainHeadPrefab, transform.position.SetZ(transform.position.z - 0.05f), Quaternion.identity, transform.parent).GetComponent <ChainHeadView>(); chainHead.game = game; chainHead.nextNoteView = this; ringSpriteRenderer.enabled = false; fillSpriteRenderer.enabled = false; } if (chainRenderer != null) { chainRenderer.enabled = drawChain; } }