Esempio n. 1
0
    static public void DrawLayoutDialogTextField(DialogPartData unit)
    {
        ViNoEditorUtil.BeginGreenColor();

        EditorGUILayout.BeginHorizontal();

/*					if( _DIALOG_TEX == null ){
 *                              _DIALOG_TEX = AssetDatabase.LoadAssetAtPath("Assets/017722-dialog.png", typeof(Texture2D)) as Texture2D;
 *                      }
 *                      GUILayout.Box( _DIALOG_TEX , GUILayout.Width( 54f ) , GUILayout.Height( 54f ) );
 * //*/
        GUILayout.Space(30f);
        if (!unit.isClearMessageAfter)
        {
            unit.dialogText = EditorGUILayout.TextArea(unit.dialogText, GUI.skin.textArea);
        }
        else
        {
            unit.dialogText = EditorGUILayout.TextArea(unit.dialogText, GUI.skin.textArea, GUILayout.Height(50f));
        }

        EditorGUILayout.EndHorizontal();

        ViNoEditorUtil.EndGUIColor();
    }
Esempio n. 2
0
    public override void OnInspectorGUI()
    {
        ViNoEditorUtil.BeginSoundGUIColor();

        PlaySoundNode node = target as PlaySoundNode;

        node.m_SoundType = (PlaySoundNode.SoundType)EditorGUILayout.EnumPopup("Category", node.m_SoundType);           // , GUILayout.Width( 75f ) );

        if (m_SoundPlInstance as ViNoSoundPlayer)
        {
            switch (node.m_SoundType)
            {
            case PlaySoundNode.SoundType.MUSIC:
                node.m_SoundID = EditorGUILayout.Popup("Music", node.m_SoundID, m_SoundEntries);
                if (m_SoundEntries != null && m_SoundEntries.Length > 0)
                {
                    if (node.m_SoundID >= m_SoundEntries.Length)
                    {
                        node.m_SoundID = 0;
                    }
                    node.m_SoundName = m_SoundEntries[node.m_SoundID];
                }
                break;

            case PlaySoundNode.SoundType.SE:
                node.m_SoundID = EditorGUILayout.Popup("SE", node.m_SoundID, m_SeEntries);
                if (m_SeEntries != null && m_SeEntries.Length > 0)
                {
                    if (node.m_SoundID >= m_SeEntries.Length)
                    {
                        node.m_SoundID = 0;
                    }
                    node.m_SoundName = m_SeEntries[node.m_SoundID];
                }
                break;

            case PlaySoundNode.SoundType.VOICE:
                node.m_SoundID = EditorGUILayout.Popup("Voice", node.m_SoundID, m_VoiceEntries);
                if (m_VoiceEntries != null && m_VoiceEntries.Length > 0)
                {
                    if (node.m_SoundID >= m_VoiceEntries.Length)
                    {
                        node.m_SoundID = 0;
                    }
                    node.m_SoundName = m_VoiceEntries[node.m_SoundID];
                }
                break;
            }

//			EditorGUILayout.EndHorizontal();
        }
        else if (m_SoundPlInstance as SimpleSoundPlayer)
        {
            node.m_SoundName = EditorGUILayout.TextField("Path", node.m_SoundName);                 // new GUIContent( "path" ,  ViNoEditorResources.folderIcon ).
        }

        node.m_Delay = EditorGUILayout.Slider("Delay(sec)", node.m_Delay, 0f, 5f);

        ViNoEditorUtil.EndSoundGUIColor();
    }
Esempio n. 3
0
    public override void OnInspectorGUI()
    {
        ViNoEditorUtil.BeginSoundGUIColor();

        DrawDefaultInspector();

        ViNoEditorUtil.EndSoundGUIColor();
    }
Esempio n. 4
0
    /// <summary>
    /// Create1s the layer.
    /// </summary>
    /// <returns>
    /// return the layer root Object.
    /// </returns>
    static public GameObject Create1Layer(string objName, GameObject parentObj)
    {
        string     origin         = ViNoToolUtil.GetAssetDataPath() + "Templates/Objects/SimpleCharacter/SimpleCharacter.prefab";
        string     pathWithoutExt = "Assets/" + objName + "/";
        GameObject layer          = CreateASimpleLayer(objName, origin, parentObj);
        string     path           = pathWithoutExt + objName + ".prefab";

        ViNoEditorUtil.CreatePrefab(layer, path);
        return(layer);
    }
Esempio n. 5
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);
     }
 }
Esempio n. 6
0
    /// <summary>
    /// Create2s the layer.
    /// </summary>
    /// <returns>
    /// return the layer root Object.
    /// </returns>
    static public GameObject Create2Layer(string objName, GameObject parentObj)
    {
        string     origin         = "Assets/" + ViNoToolUtil.kAssetName + "/Templates/Objects/SimpleCharacter2/SimpleCharacter2.prefab";
        string     pathWithoutExt = "Assets/" + objName + "/";
        GameObject clone          = CreateCharaNode(objName, parentObj, origin, pathWithoutExt);
        float      alpha          = 1f;

        CreateCharaChild(clone, "layer1", m_CharaTex1, pathWithoutExt, alpha);
        alpha = 0f;
        CreateCharaChild(clone, "layer2", m_CharaTex2, pathWithoutExt, alpha);
        EditorGUIUtility.PingObject(clone);
        string path = pathWithoutExt + objName + ".prefab";

        ViNoEditorUtil.CreatePrefab(clone, path);
        return(clone);
    }
Esempio n. 7
0
    // -----------------------------------------------------------------------------------.

    /// <summary>
    /// Creates the B.
    /// </summary>
    /// <returns>
    /// return the layer root Object.
    /// </returns>
    static public GameObject CreateBG(string objName, GameObject parentObj)
    {
        string     origin         = ViNoToolUtil.GetAssetDataPath() + "Templates/Objects/BG/SimpleBG.prefab";
        string     pathWithoutExt = "Assets/" + objName + "/";
        GameObject clone          = CreateCharaNode(objName, parentObj, origin, pathWithoutExt);

        EditorGUIUtility.PingObject(clone);
        float alpha = 1f;

        CreateCharaChild(clone, "layer1", m_CharaTex1, pathWithoutExt, alpha);
#if false
        alpha = 0f;
        CreateCharaChild(clone, "layer2", m_CharaTex2, pathWithoutExt, alpha);
#endif
        string path = pathWithoutExt + objName + ".prefab";
        ViNoEditorUtil.CreatePrefab(clone, path);
        return(clone);
    }
    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
    }
Esempio n. 10
0
    static public void CreatePrefab(GameObject obj, string objName)
    {
        string path = "Assets/" + objName + "/" + objName + ".prefab";

        ViNoEditorUtil.CreatePrefab(obj, path);
    }
    public void OnGUI_DialogPart(DialogPartNode targetNode)
    {
//		m_SelectedModeID = GUILayout.Toolbar( m_SelectedModeID , m_ModeItems );
//		m_CurrMode = (Mode)m_SelectedModeID;

        // ------- There are two TextBox field before ! ------.

        DrawDialogTextBoxAndNameField(targetNode);

        // ---------------------------------------------------.

//TODO : TEST SOUND DATA PROPERTY!!
#if false
        if (soundDataProp != null)
        {
            EditorGUILayout.PropertyField(soundDataProp);
        }

/*
 *                      EditorGUILayout.BeginHorizontal();
 *                              EditorGUILayout.LabelField( "SoundData", GUILayout.Width( 100f) );
 *                              soundData = EditorGUILayout.ObjectField( soundData , typeof( ScriptableSoundData ) , true ) as ScriptableSoundData;
 * //			    soundDataProp = EditorGUILayout.ObjectField( soundDataProp, typeof( ScriptableSoundData ) , true ) as ScriptableSoundData;
 *                      EditorGUILayout.EndHorizontal();
 * //*/
#endif

//		EditorGUILayout.EndVertical();
//		EditorGUILayout.BeginHorizontal();
//		EditorGUILayout.EndHorizontal();

        m_ViewMode = GUILayout.Toolbar(m_ViewMode, m_MenuItems);

//		ViNoEditorUtil.BeginGreenColor();

        string menu = m_MenuItems[m_ViewMode];

        // View Mode : XML.
        if (menu == "XML")
        {
            ViNoEditorUtil.BeginGreenColor();

            DrawImportField(targetNode);

            ViNoEditorUtil.EndGUIColor();
        }
        // Actions or Edit Text Mode.
        else
        {
#if true
            if (menu == "Actions")
            {
                EditorGUILayout.BeginHorizontal();

                /*				if( GUILayout.Button( "Open "+ System.Environment.NewLine +" Dialogs" )){
                 *                                      m_ShowAllToggle = ! m_ShowAllToggle;
                 *                                      for( int i=0;i<targetNode.dlgDataList.Count;i++){
                 *                                              targetNode.dlgDataList[ i ].show = m_ShowAllToggle;
                 *                                      }
                 *                              }
                 * //*/
                if (GUILayout.Button("Check " + System.Environment.NewLine + " ALL"))
                {
                    //				if( GUILayout.Button( new GUIContent( "All" , ViNoEditorResources.checkAllcon ) , GUILayout.Width( 62f ) , GUILayout.Height( 22f ) ) ){// "Check " + System.Environment.NewLine + " ALL" )){
                    for (int i = 0; i < targetNode.dlgDataList.Count; i++)
                    {
                        targetNode.dlgDataList[i].active = true;
                    }
                }

                if (GUILayout.Button("UNCheck" + System.Environment.NewLine + "ALL"))
                {
                    //				if( GUILayout.Button( uncheckTex ) ){
                    for (int i = 0; i < targetNode.dlgDataList.Count; i++)
                    {
                        targetNode.dlgDataList[i].active = false;
                    }
                }

                if (GUILayout.Button("Swap Checked" + System.Environment.NewLine + "2 Items"))
                {
                    DialogPartNodeUtility.Swap2Items(targetNode);
                }

                GUI.enabled = true;

                EditorGUILayout.EndHorizontal();
            }
#endif
            if (targetNode.dlgDataList != null)
            {
                for (int i = 0; i < targetNode.dlgDataList.Count; i++)
                {
                    DialogPartData unit = targetNode.dlgDataList[i];
                    if (menu == "Actions")                               //&& unit.actionID != DialogPartNodeActionType.Dialog ){
                    {
                        NodeGUI.DrawDialogItemBar(targetNode, ref unit, i, targetNode.m_ViNoTextBox, targetNode.m_NameTextBox);
                    }
                    NodeGUI.OnGUI_a(targetNode, ref unit, i, targetNode.m_ViNoTextBox, targetNode.m_NameTextBox, m_ViewMode);
                }
            }
            else
            {
                DialogPartNodeUtility.Initialize(targetNode);
            }
            DialogPartNodeInspector.DrawDialogListUtil(targetNode);
        }
//			ViNoEditorUtil.EndGUIColor();
    }
Esempio n. 12
0
    private void DrawAnimationTab( )
    {
//				animationTarget = EditorGUILayout.ObjectField( animationTarget , typeof( GameObject ) , true ) as GameObject;
        if (Application.isPlaying)
        {
            if (Selection.activeGameObject == null)
            {
                GUIStyle myStyle = new GUIStyle();
                myStyle.fontSize = 20;
                GUILayout.Label("Please Select a Target GameObject in Hierarchy", myStyle);
//						ViNoEditorUtil.DrawWarningString("Please Select a Target GameObject in Hierarchy" );
            }
            else
            {
                if (m_CurrSelected != Selection.activeGameObject)
                {
                    m_CurrSelected = Selection.activeGameObject;
                }
                GUI.enabled = true;
            }
            bool isSelectedHasPanel = false;
            if (Selection.activeGameObject != null)
            {
                ColorPanel panel    = Selection.activeGameObject.GetComponent <ColorPanel>();
                int        childNum = Selection.activeGameObject.transform.GetChildCount();
                isSelectedHasPanel = (panel != null);
                if (panel == null)
                {
                    ViNoEditorUtil.DrawWarningString("FadeIn and FadeOut : Target GameObject is required to be attached a ColorPanel Component");
                    GUI.enabled = false;
                }
                else
                {
                    GUI.enabled = true;
                }
            }
        }
        else
        {
            GUI.enabled = false;
            GUIStyle myStyle = new GUIStyle();
            myStyle.fontSize = 30;

            EditorGUILayout.BeginHorizontal();

            GUILayout.Space(10f);
            GUILayout.Label("PlayMode Only", myStyle);

            EditorGUILayout.EndHorizontal();

            return;
//					ViNoEditorUtil.DrawWarningString("Please use Animation Tab in PlayMode." );
        }

        EditorGUILayout.BeginHorizontal();

        if (GUILayout.Button(m_FadeInIcon, GUILayout.Width(80f), GUILayout.Height(50f)))
        {
//					if( GUILayout.Button( "FadeIn" ,  GUILayout.Width( 80f ) , GUILayout.Height ( 50f ) ) ){
//						AnimationNode animNode = ViNoToolUtil.AddViNodeGameObject<AnimationNode>( "FadeIn" , m_AddedObject.transform );
            GameObject    animObj  = new GameObject("_Anim");
            AnimationNode animNode = animObj.AddComponent <AnimationNode>();
            animNode.animTarget       = Selection.activeGameObject;
            animNode.animationType    = AnimationType.FADE_PANEL;
            animNode.duration         = duration;
            animNode.fadeTo           = 1f;
            animNode.fadeFrom         = 0f;
            animNode.toggleFromAmount = true;
            animNode.Preview();
        }

        if (GUILayout.Button(m_FadeOutIcon, GUILayout.Width(80f), GUILayout.Height(50f)))
        {
//						AnimationNode animNode = ViNoToolUtil.AddViNodeGameObject<AnimationNode>( "FadeOut" , m_AddedObject.transform );
            GameObject    animObj  = new GameObject("_Anim");
            AnimationNode animNode = animObj.AddComponent <AnimationNode>();
            animNode.animTarget       = Selection.activeGameObject;
            animNode.animationType    = AnimationType.FADE_PANEL;
            animNode.duration         = duration;
            animNode.fadeTo           = 0f;
            animNode.fadeFrom         = 1f;
            animNode.toggleFromAmount = true;
            animNode.Preview();
        }

        if (Selection.activeGameObject != null && Application.isPlaying)
        {
            GUI.enabled = true;
        }

        // Slide IN.
        if (GUILayout.Button(m_SlideInIcon, GUILayout.Width(80f), GUILayout.Height(50f)))
        {
            float slideToX   = m_SlideInL_X;
            float slideFromX = m_SlideInL_X - 700f;

            SlideSelectionObjects(slideToX, slideFromX, duration);
        }

        // Slide OUT.
        if (GUILayout.Button(m_SlideOutIcon, GUILayout.Width(80f), GUILayout.Height(50f)))
        {
            float slideFromX = Selection.activeGameObject.transform.localPosition.x;
            SlideSelectionObjects(-700f, slideFromX, duration);
        }

        // Rotate Object.
        if (GUILayout.Button(m_TurnIcon, GUILayout.Width(80f), GUILayout.Height(50f)))
        {
            AnimationNode animNode = GetAnimationNodeTempl(AnimationType.ROTATE_TO, duration);

            float nowY = Selection.activeGameObject.transform.localEulerAngles.y;
            animNode.amountX = 0f;                    // = new Vector3( 0f , 358f , 0f );
            animNode.amountY = nowY + 180f;           //180f;
            animNode.amountZ = 0f;

            animNode.toggleFromAmount = false;
            animNode.Preview();
        }

        EditorGUILayout.EndHorizontal();

        float halfScrW = Screen.width / 2f;

        m_SlideInL_X = EditorGUILayout.Slider("Slide In LeftPosition", m_SlideInL_X, -halfScrW, +halfScrW);
        m_SlideInR_X = EditorGUILayout.Slider("Slide In RightPosition", m_SlideInR_X, -halfScrW, +halfScrW);
        duration     = EditorGUILayout.Slider("duration( ms )", duration, 1f, 5000f);

/*				if( GUILayout.Button( "OK" ) ){
 *
 *                                      GameObject scenarioObj = ViNoToolUtil.CreateANewScenario( ViNoToolbox.m_ScenarioName , ViNoToolbox.m_StartAndPlay );
 *
 *                              }
 * //*/
    }