Esempio n. 1
0
 static public void BeginGreenColor()
 {
     if (EditorGUIUtility.isProSkin)
     {
         ViNoEditorUtil.BeginGUIColor(GUI.color, Color.green, GUI.contentColor);
     }
     else
     {
         ViNoEditorUtil.BeginGUIColor(Color.white, new Color(0.8f, 0.8f, 0.8f, 1f), Color.black);
     }
 }
    static public void DrawDialogListUtil(DialogPartNode node)
    {
        GUICommon.DrawLineSpace(10f, 5f);

        ViNoEditorUtil.BeginGUIColor(Color.green, GUI.backgroundColor, GUI.contentColor);            //Color.black , Color.white );

        GUILayout.BeginHorizontal();

//			GUILayout.Space( Screen.width/2f );

        if (GUILayout.Button("+"))
        {
//			if( GUILayout.Button( ViNoEditorResources.plusIcon ) ){
//				node.AddData( new DialogPartData() );// AddData( node );
//				Debug.Log( "Register Scene Undo");
            Undo.RegisterUndo(node, node.name);
//					 Undo.SetSnapshotTarget( node , node.name );

            int itemNum = node.GetMessageNum();
            node.AddItemAt(itemNum);
            node.ReAssignDialogIDsInThisObject();
        }

        if (GUILayout.Button("-"))
        {
//			if( GUILayout.Button( ViNoEditorResources.minusIcon ) ){//} , GUILayout.Width( sa ) ) ){
            Undo.RegisterUndo(node, node.name);
//				if( EditorUtility.DisplayDialog( "Remove the Last Item ?" , "Are you sure you really want to remove?"
//					, "Yes", "Cancel" ) ){
            if (node.dlgDataList != null && node.dlgDataList.Count > 0)
            {
                node.dlgDataList.RemoveAt(node.dlgDataList.Count - 1);
            }
            node.ReAssignDialogIDsInThisObject();
//				}
        }

        GUILayout.EndHorizontal();

        ViNoEditorUtil.EndGUIColor();
    }
    void OnGUI()
    {
/*		if( m_DialogIconTex == null || m_ArrowBackTex == null || m_ArrowForwardTex == null ){
 *                      LoadIcons();
 *              }
 * //*/

#if false
        if (EditorGUIUtility.isProSkin)
        {
            ViNoEditorUtil.BeginGUIColor(GUI.color, Color.green, GUI.contentColor);
        }
        else
        {
//			ViNoEditorUtil.BeginGUIColor( Color.white , new Color( 0f , 0.8f , 0f , 1f ) , Color.black );
            ViNoEditorUtil.BeginGUIColor(Color.white, new Color(0.8f, 0.8f, 0.8f, 1f), Color.black);
        }
#endif

        m_ScrollPos = EditorGUILayout.BeginScrollView(m_ScrollPos);

#if false
        EditorGUILayout.BeginHorizontal();
//			GUILayout.Box( m_DialogIconTex , GUILayout.Width( 44f ) , GUILayout.Height( 44f ) );
        current = EditorGUILayout.ObjectField("Target", current, typeof(DialogPartNode), true) as DialogPartNode;
//			current = EditorGUILayout.ObjectField( m_DialogIconTex , current , typeof( DialogPartNode ) , true ) as DialogPartNode;
        EditorGUILayout.EndHorizontal();

/*
 *              if( Selection.activeGameObject != null ){
 *                      if( current != null ){
 *                              if( current.gameObject != Selection.activeGameObject ){
 *                                      current = Selection.activeGameObject.GetComponent<DialogPartNode>();
 *                                      UpdateGameView();
 *                              }
 *                      }
 *                      else{
 *                              current = Selection.activeGameObject.GetComponent<DialogPartNode>();
 *                              UpdateGameView();
 *                      }
 *              }
 *              else{
 *                      m_CurrentID = 0;
 *                      current = null;
 *                      return;
 *              }
 * //*/
        if (current != null)
        {
            m_DialogItemNum = current.GetMessageNum();
            GUI.enabled     = true;
        }
        else
        {
            GUI.enabled = false;
        }

        DrawMessageControl();
#endif

        if (current != null)
        {
            if (currentData != null)
            {
                currentData.show = false;
            }

            if (current.dlgDataList.Count == 0)
            {
                ShowNotificate();
            }
            else
            {
                if (m_CurrentID >= current.dlgDataList.Count)
                {
                    m_CurrentID = 0;
                }
                currentData      = current.dlgDataList[m_CurrentID];             //current.GetItemAt( m_CurrentID );
                currentData.show = true;

                //			NodeGUI.DrawDialogItemBar( current , ref currentData , m_CurrentID , current.m_ViNoTextBox , current.m_NameTextBox  );
                switch (currentData.actionID)
                {
                case DialogPartNodeActionType.Dialog:
                    //				DrawSceneCategory( current , currentData );
                    //				DrawActorCategory( current , currentData );
                    DrawSoundCategory(current, currentData);
                    DrawDialogCategory(current, currentData);
                    break;

                case DialogPartNodeActionType.EnterActor:
                case DialogPartNodeActionType.ExitActor:
//				case DialogPartNodeActionType.Shake:
//				case DialogPartNodeActionType.ChangeState:
                case DialogPartNodeActionType.MoveActor:
                    DrawActorCategory(current, currentData);
                    break;

//				case DialogPartNodeActionType.EnterScene:
//				case DialogPartNodeActionType.ExitScene:
//					DrawSceneCategory( current , currentData );
//					break;
                }
            }
        }
        else
        {
            ShowNotificate();
        }

        // If not play mode , Change the scene  and Message .
        if (GUI.changed)          //&& ! Application.isPlaying ){
        {
            UpdateGameView();
        }

//		EditorGUILayout.LabelField( "Dialog Item Num" + m_DialogItemNum.ToString() );
        EditorGUILayout.EndScrollView();

        GUI.enabled = true;



#if false
        ViNoEditorUtil.EndGUIColor();
#endif
    }