void iListener.OnEvent(EVENT_T t, float val, iListener ch) { if (mListener != null) { mListener.OnEvent(t, val, ch); } }
void iListener.OnEvent(EVENT_T t, float val, iListener ch) { string name_info = "none"; if (ch is STLButton) { name_info = (ch as STLButton).name; } Debug.LogError(string.Format("Event {0}, {1}", t, name_info)); if (mListener != null) { mListener.OnEvent(t, val, ch); } }
void iListener.OnEvent(EVENT_T t, float val, iListener ch) { switch (t) { case (EVENT_T.ON_ADD): { distAdd = 1; angleAdd = 0; STRootNode root = STLevel.GetRootNode(); if (root != null) { STNode node = Instantiate(root.NodePref) as STNode; if (node != null) { node.transform.parent = mRotor.transform; do { if (distAdd > 5) { break; } if (angleAdd >= 360) { angleAdd = 0; distAdd++; } Vector3 transformPos = new Vector3(STLevel.GetNodesNet().NetBtwNodesWidth() * Mathf.Cos(angleAdd / 180 * Mathf.PI) * distAdd, STLevel.GetNodesNet().NetBtwNodesWidth() * Mathf.Sin(angleAdd / 180 * Mathf.PI) * distAdd, 0); node.transform.localPosition = mRotor.transform.localPosition + transformPos; angleAdd += 45; node.transform.position = STLevel.GetNodesNet().GetClothestNetNodePos(node.transform.position); Debug.Log(node.transform.position); }while(STLevel.GetRootNode().CheckForIntersection(node.transform.position.x, node.transform.position.y, transform.position.x, transform.position.y, 0, 0) == true); node.transform.localRotation = mRotor.transform.localRotation; node.mParent = this; mRotor.mChilds.Add(node); STLevel.GetNodesNet().ShowElementNetNode(transform.position); STLevel.GetNodesNet().HideElementNetNode(); //node.mLink.UpdatePos (transform.position); Vector3 thepos = STLevel.GetNodesNet().GetClothestNetNodePos(node.transform.position); node.transform.position = new Vector3(thepos.x, thepos.y, node.transform.position.z); node.UpdateLinkPosition(node.transform.position); showBranchSelection(); } } break; } case (EVENT_T.ON_REMOVE): { if (mParent != null) { Destroy(this.gameObject); mParent.mRotor.mChilds.Remove(this); } break; } case (EVENT_T.ON_CHANGE): { this.changeNodeType(); STLevel.UpdateActiveNodes(); break; } } }