static public void GenerateSelections(List <byte> byteList, SelectionsNode.SelectUnit[] units, string title) { if (ISelectionsCtrl.Instance == null) { ISelectionsCtrl selObj = GameObject.FindObjectOfType(typeof(ISelectionsCtrl)) as ISelectionsCtrl; if (selObj == null) { Debug.LogError("ISelectionsCtrl Not Exists."); return; } } if (!SelectionsNode.IsTargetSet(units)) { return; } ByteCodeScriptTools.AddMessagingCode(byteList, "Dialog", OpcodeMessaging.SELECTIONS); ByteCodeScriptTools.AddTextLiteralCode(byteList, title); byteList.Add(Opcode.SELECTIONS); for (int i = 0; i < units.Length; i++) { if (units[i].targetNode != null) { SelectionsNode.SelectUnit unit = units[i]; string targetFunc = units[i].targetNode.GetNodeLabel(); //Tag( unit.targetNode.name ); CodeGenerator.GenerateASelection(byteList, i, targetFunc, unit.text, unit.checkFlag, unit.flagName); } } byteList.Add(Opcode.STOP); }
public static bool IsTargetSet( SelectionsNode.SelectUnit[] units ) { for( int i=0;i<units.Length;i++){ if( units[ i ].targetNode == null ){ Debug.Log( "TargetNode is not set" ); return false; } } return true; }
static public void CreateSelectionsNodeOfMenu( ) { ISelectionsCtrl sel = GameObject.FindObjectOfType(typeof(ISelectionsCtrl)) as ISelectionsCtrl; if (sel == null) { DrawObjectsTab.CreateGUISelectionsCtrl(); } Transform parentNodeTra = (Selection.activeGameObject != null) ? Selection.activeGameObject.transform : null; SelectionsNode node = ViNoToolUtil.AddViNodeGameObject <SelectionsNode>("Selections", parentNodeTra); ViNode childNode1 = ViNoToolUtil.AddViNodeGameObject <ViNode>("Selected1", node.transform); ViNode childNode2 = ViNoToolUtil.AddViNodeGameObject <ViNode>("Selected2", node.transform); DialogPartNode dlg1 = CreateDialogNode("name", "Selected 1"); //ViNoToolUtil.AddViNodeGameObject<DialogPartNode>( "Dialog" , childNode1.transform ); dlg1.transform.parent = childNode1.transform; DialogPartNode dlg2 = CreateDialogNode("name", "Selected 2"); //ViNoToolUtil.AddViNodeGameObject<DialogPartNode>( "Dialog" , childNode2.transform ); dlg2.transform.parent = childNode2.transform; node.units = new SelectionsNode.SelectUnit [2]; node.units[0] = new SelectionsNode.SelectUnit(); node.units[0].targetNode = childNode1; node.units[0].text = "Selection 1"; node.units[0].index = 0; node.units[1] = new SelectionsNode.SelectUnit(); node.units[1].targetNode = childNode2; node.units[1].text = "Selection 2"; node.units[1].index = 1; EditorGUIUtility.PingObject(node.gameObject); }
public static void GenerateSelections( List<byte> byteList , SelectionsNode.SelectUnit[] units , string title ) { if( ISelectionsCtrl.Instance == null ){ ISelectionsCtrl selObj = GameObject.FindObjectOfType( typeof( ISelectionsCtrl )) as ISelectionsCtrl; if( selObj == null ){ Debug.LogError( "ISelectionsCtrl Not Exists." ); return; } } if( ! SelectionsNode.IsTargetSet( units ) ){ return; } ByteCodeScriptTools.AddMessagingCode( byteList , "Dialog" , OpcodeMessaging.SELECTIONS ); ByteCodeScriptTools.AddTextLiteralCode( byteList , title ); byteList.Add( Opcode.SELECTIONS ); for( int i=0;i<units.Length;i++){ if( units[ i ].targetNode != null ){ SelectionsNode.SelectUnit unit = units[ i ]; string targetFunc = units[ i ].targetNode.GetNodeLabel();//Tag( unit.targetNode.name ); CodeGenerator.GenerateASelection( byteList , i , targetFunc , unit.text , unit.checkFlag , unit.flagName ); } } byteList.Add( Opcode.STOP ); }
// static private int k_TextDispNum = 25; public static void OnGUISelectionUnit( SelectionsNode.SelectUnit unit ) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField( "target"); unit.targetNode = EditorGUILayout.ObjectField( unit.targetNode , typeof(ViNode) , true ) as ViNode; EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField( "Text"); unit.text = EditorGUILayout.TextField( unit.text ); EditorGUILayout.EndHorizontal(); }