DUNILOG  1.7
 All Classes Functions Variables Pages
How to setup a custom player
  1. Copy DUGViewCustom (code at the end of this page)
  2. Remove DUGView component from DUGManager prefab
  3. Add your copy of DUGViewCustom to DUGManager prefab
  4. Change your copy of DUGViewCustom to what you need

    using UnityEngine;
    using System.Collections.Generic;
    public class DUGViewCustom : MonoBehaviour {
    public bool visible = true;
    private DUGDataNode mCurrentNode;
    void Start()
    {
    DUGController.Init( gameObject.GetComponent<DUGModel>() );
    mCurrentNode = DUGController.Run();
    }
    void OnGUI()
    {
    DrawAll( DUGController.data );
    }
    public void DrawAll( DUGModel data )
    {
    if( mCurrentNode == null ) return;
    if( mCurrentNode.type == DUGDataNode.Type.Dialog_Text ) {
    DUGDataActor actor = data.GetActorById( mCurrentNode.actorId );
    GUILayout.BeginHorizontal( GUILayout.Width(500) );
    GUILayout.BeginVertical();
    // actor
    GUILayout.Label( actor.image, GUILayout.Width(100), GUILayout.Height(100) );
    GUILayout.Label( actor.name, GUILayout.Width(100) );
    // variable
    foreach( var variable in data.listVariable ) {
    if( DUGController.ShouldVariableBeDisplayed( variable ) ) {
    GUILayout.BeginHorizontal();
    GUILayout.Label( variable.image, GUILayout.Width(16), GUILayout.Height(16) );
    GUILayout.Label( variable.name );
    GUILayout.EndHorizontal();
    }
    }
    GUILayout.EndVertical();
    GUILayout.BeginVertical();
    // text
    List<DUGDataNodeEntry> entries = mCurrentNode.listEntries;
    for( int i=0; i<entries.Count; i++ ) {
    if( DUGController.IsEntryActive( entries[i] ) ) {
    string text = DUGController.GetRunTimeTextForEntry( entries[i] );
    if( DUGController.IsEntryLinked( entries[i] ) ) {
    if( GUILayout.Button( text, GUILayout.Width(400) ) ) {
    mCurrentNode = DUGController.GetNextNode(i);
    }
    } else {
    GUILayout.Label( text, GUILayout.Width(400) );
    }
    }
    }
    if( DUGController.CanGetPreviousNode(true) && GUILayout.Button( "<< Back", GUILayout.Width(400) ) ) mCurrentNode = DUGController.GetPreviousNode( true );
    GUILayout.EndVertical();
    GUILayout.EndHorizontal();
    }
    }
    }