コード例 #1
0
    static public void AddPlaySoundCode(List <byte> byteList, string tag, string audioPath, string loop)
    {
        Hashtable args = new Hashtable();

        args["eventType"] = tag;
        args["storage"]   = audioPath;
        args["loop"]      = loop;
        ByteCodeScriptTools.AddTablePairsCode(byteList, args);
        ByteCodeScriptTools.AddMessagingCode(byteList, " ", OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS);
    }
コード例 #2
0
    static public void AddDialogEventArgs(List <byte> byteList, string eventType, int messageID, string nodeName, string dialogText)
    {
        Hashtable args = new Hashtable();

        args["eventType"]  = eventType;
        args["ID"]         = messageID.ToString();
        args["nodeName"]   = nodeName;
        args["dialogText"] = dialogText;

        ByteCodeScriptTools.AddTablePairsCode(byteList, args);
        ByteCodeScriptTools.AddMessagingCode(byteList, nodeName, OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS);
    }
コード例 #3
0
    static public void GenerateASelection(List <byte> byteList, int index, string targetFuncName, string text, bool checkFlag, string flagName)
    {
        Hashtable param = new Hashtable();

        param["target"] = targetFuncName;
        param["text"]   = text;
        if (checkFlag)
        {
            param["IsFlagOn"] = flagName;
        }
        ByteCodeScriptTools.AddTablePairsCode(byteList, param);
        byteList.Add(Opcode.LINK);
//		ByteCodeScriptTools.AddMessagingCode( byteList , "Select-" + index.ToString() , OpcodeMessaging.LINK );
    }
コード例 #4
0
    public override void ToByteCode(ByteCodes code)
    {
        List <byte> byteList = new List <byte>();

        AddNodeCode(byteList);

        ISoundPlayer pl = ISoundPlayer.Instance;

        if (pl as ViNoSoundPlayer)
        {
            Hashtable tbl = new Hashtable();
            tbl["name"] = m_SoundName;
            switch (m_SoundType)
            {
            case SoundType.MUSIC:
                tbl["category"] = "Music";
                break;

/*			case SoundType.SE:
 *                                      tbl[ "category" ] = "SE";
 *                                      break;
 *
 *                      case SoundType.VOICE:
 *                                      tbl[ "category" ] = "Voice";
 *                                      break;
 * //*/
            }
            tbl["fadeOutSeconds"] = m_FadeOutSeconds.ToString();
            ByteCodeScriptTools.AddTablePairsCode(byteList, tbl);
            ByteCodeScriptTools.AddMessagingCode(byteList, "env", OpcodeMessaging.STOP_SOUND);
        }
        else if (pl as SimpleSoundPlayer)
        {
            Hashtable args = new Hashtable();
            args["eventType"] = "fadeoutbgm";
            int time = (int)(m_FadeOutSeconds * 1000f);
            args["time"] = time.ToString();
            ByteCodeScriptTools.AddTablePairsCode(byteList, args);
            ByteCodeScriptTools.AddMessagingCode(byteList, " ", OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS);
        }
        code.Add(byteList.ToArray());

        ToByteCodeInternal(code);
    }
コード例 #5
0
    public override void ToByteCode(ByteCodes code)
    {
        base.ToByteCode(code);

        List <byte> byteList = new List <byte>();

#if false
        Hashtable hash = MakeHash(anyResourcePath, method, withFadeIn);
        ByteCodeScriptTools.AddTablePairsCode(byteList, hash);
        code.Add(byteList.ToArray());
        code.Add(Opcode.LOAD_SCENE);
#else
        Hashtable args = new Hashtable();
        args["eventType"] = "enterscene";
        args["name"]      = sceneName;
        args["destroy"]   = (method == Methods.DESTROY_AND_LOAD) ? "true" : "false";
        args["fade"]      = withFadeIn ? "true" : "false";
        ByteCodeScriptTools.AddTablePairsCode(byteList, args);
        ByteCodeScriptTools.AddMessagingCode(byteList, " ", OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS);
        code.Add(byteList.ToArray());
#endif
        ToByteCodeInternal(code);
    }
コード例 #6
0
    public override void ToByteCode(ByteCodes code)
    {
        if (animTarget == null)
        {
            ViNoDebugger.LogWarning("Animation Target Not Set");
            return;
        }

        SetUpParamTable();

        List <byte> byteList = new List <byte>();

        // Labeling.
        AddNodeCode(byteList);

#if false
// instantiate prefab , if target is in asset.
        if (isTargetInAsset)
        {
            Debug.Log("add load resource :" + animTarget.name);
            // Add CreateObjectNode.ToByteCode...
            ByteCodeScriptTools.AddLoadResourceCode(byteList, animTarget.name);

            GameObject parent = null;
            if (Application.isPlaying)
            {
                parent = ViNoSceneManager.Instance.theSavedPanel;
            }
            else
            {
                ViNoSceneManager sm = GameObject.FindObjectOfType(typeof(ViNoSceneManager)) as ViNoSceneManager;
                parent = sm.theSavedPanel;
            }

            if (parent == null)
            {
                // SceneManager Not Needed user .
                parent = Camera.main.gameObject;
            }

            Debug.Log("AddCreateGOCode :" + parent.name);
            ByteCodeScriptTools.AddCreateGOCode(byteList, parent);
        }
        else
        {
            Debug.Log("target is in scene...");
        }
#endif

        ByteCodeScriptTools.AddTablePairsCode(byteList, paramTbl);
        byte op = OpcodeMessaging.TWEEN;
        switch (animationType)
        {
        case AnimationType.FADE_PANEL:          op = OpcodeMessaging.FADE_PANEL;        break;

        case AnimationType.CROSS_FADE:          op = OpcodeMessaging.CROSS_FADE;        break;
        }
        ByteCodeScriptTools.AddMessagingCode(byteList, animTarget.name, op);

        code.Add(byteList.ToArray());

        ToByteCodeInternal(code);
    }
コード例 #7
0
    /// <summary>
    /// Generates a Dialog code.
    /// </summary>
    /// <param name='byteList'>
    /// Byte list.
    /// </param>
    /// <param name='isName'>
    /// Is name.
    /// </param>
    /// <param name='isClearMessageAfter'>
    /// Is clear message after.
    /// </param>
    /// <param name='textNameHndStr'>
    /// Text name hnd string.
    /// </param>
    /// <param name='nameText'>
    /// Name text.
    /// </param>
    /// <param name='textDialogHndStr'>
    /// Text dialog hnd string.
    /// </param>
    /// <param name='dialogText'>
    /// Dialog text.
    /// </param>
    static public void GenerateADialogCode(
        List <byte> byteList, DialogPartData data, string textNameHndStr, string textDialogHndStr)
    {
// Currently not show.
#if false
        if (data.isClearScene)
        {
            // Clear Current Shown Scene.
            byteList.Add(Opcode.CLEAR_SCENE);
        }

        if (!string.IsNullOrEmpty(data.sceneFilePath))
        {
            AddSceneAdditiveCode(byteList, data.sceneFilePath, data.isFadeInStart);
        }
#endif

/*		else{
 *                      Debug.LogWarning( "Action:Scene data.sceneFilePath must not be null or empty." );
 *              }
 * //*/
        switch (data.actionID)
        {
        case DialogPartNodeActionType.EnterActor:
            for (int i = 0; i < data.enterActorEntries.Length; i++)
            {
                DialogPartData.ActorEntry entry = data.enterActorEntries[i];
//					Debug.Log ( "ADDCODE ACTOR:" + entry.actorName );
                Hashtable args = new Hashtable();
                args["eventType"] = data.actionID.ToString().ToLower();
                args["name"]      = entry.actorName;
                args["position"]  = entry.position.ToString();
                args["fade"]      = entry.withFade.ToString().ToLower();
                ByteCodeScriptTools.AddTablePairsCode(byteList, args);
                ByteCodeScriptTools.AddMessagingCode(byteList, " ", OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS);
            }
            break;

        case DialogPartNodeActionType.MoveActor:
            for (int i = 0; i < data.enterActorEntries.Length; i++)
            {
                DialogPartData.ActorEntry entry = data.enterActorEntries[i];
                Hashtable args = new Hashtable();
                args["eventType"] = data.actionID.ToString().ToLower();
                args["name"]      = entry.actorName;
                args["position"]  = entry.position.ToString();
                ByteCodeScriptTools.AddTablePairsCode(byteList, args);
                ByteCodeScriptTools.AddMessagingCode(byteList, " ", OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS);
            }
            break;

        case DialogPartNodeActionType.ExitActor:
            for (int i = 0; i < data.exitActorEntries.Length; i++)
            {
                DialogPartData.ActorEntry entry = data.exitActorEntries[i];
                Hashtable args = new Hashtable();
                args["eventType"] = data.actionID.ToString().ToLower();
                args["name"]      = entry.actorName;
                args["fade"]      = entry.withFade.ToString().ToLower();
                ByteCodeScriptTools.AddTablePairsCode(byteList, args);
                ByteCodeScriptTools.AddMessagingCode(byteList, " ", OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS);
            }
            break;

        case DialogPartNodeActionType.Dialog:
            AddAudioCode(byteList, data);

            if (data.isName)
            {
                AddSetTextCode(byteList, data.nameText, textNameHndStr);
            }
            else
            {
                AddHideMessageCode(byteList, textNameHndStr);
            }

            AddCurrentCode(byteList, textDialogHndStr);
            string str = data.dialogText;
            if (!data.isClearMessageAfter)
            {
                str += System.Environment.NewLine;
            }
            ByteCodeScriptTools.AddStringCode(byteList, str);
            byteList.Add(Opcode.PRINT);
            byteList.Add(Opcode.WAIT_TOUCH);

            if (data.isClearMessageAfter)
            {
                byteList.Add(Opcode.CM);
            }
            break;

/*			case DialogPartNodeActionType.ChangeState:
 *                              for( int i=0;i<data.exitActorEntries.Length;i++){
 *                                      DialogPartData.ActorEntry entry= data.exitActorEntries[ i ];
 *                                      Hashtable args = new Hashtable();
 *                                      args[ "eventType" ] = data.actionID.ToString().ToLower();
 *                                      args[ "name" ] = entry.actorName;
 *                                      args[ "state" ] = entry.state;
 *                                      args[ "fade" ] = entry.withFade.ToString().ToLower();
 *                                      ByteCodeScriptTools.AddTablePairsCode( byteList , args );
 *                                      ByteCodeScriptTools.AddMessagingCode( byteList , " " , OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS );
 *                              }
 *                              break;
 *
 *                      case DialogPartNodeActionType.Shake:
 *                              for( int i=0;i<data.exitActorEntries.Length;i++){
 *                                      DialogPartData.ActorEntry entry= data.exitActorEntries[ i ];
 *                                      Hashtable args = new Hashtable();
 *                                      args[ "eventType" ] = data.actionID.ToString().ToLower();
 *                                      args[ "name" ] = entry.actorName;
 *                                      ByteCodeScriptTools.AddTablePairsCode( byteList , args );
 *                                      ByteCodeScriptTools.AddMessagingCode( byteList , " " , OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS );
 *                              }
 *                              break;
 *                      case DialogPartNodeActionType.EnterScene:
 *                              Hashtable args = new Hashtable();
 *                              args[ "eventType" ] = data.actionID.ToString().ToLower();
 *                              args[ "name" ] = data.scene.sceneName;
 *                              args[ "fade" ] = data.scene.withFade.ToString().ToLower();
 *                              ByteCodeScriptTools.AddTablePairsCode( byteList , args );
 *                              ByteCodeScriptTools.AddMessagingCode( byteList , " " , OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS );
 *                              break;
 *
 *                      case DialogPartNodeActionType.ExitScene:
 *                               args = new Hashtable();
 *                              args[ "eventType" ] = data.actionID.ToString().ToLower();
 *                              args[ "name" ] = data.scene.sceneName;
 *                              args[ "fade" ] = data.scene.withFade.ToString().ToLower();
 *                              ByteCodeScriptTools.AddTablePairsCode( byteList , args );
 *                              ByteCodeScriptTools.AddMessagingCode( byteList , " " , OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS );
 *                              break;
 * //*/


// Show later update...
#if false
        case DialogPartNodeActionType.Scene:
            break;

        case DialogPartNodeActionType.ClearScene:
            byteList.Add(Opcode.CLEAR_SCENE);
            break;

        case DialogPartNodeActionType.PlayAnimation:
            if (data.isAnim)
            {
                byteList.Add(Opcode.PLAY_ANIMATION);
                byteList.Add((byte)data.animationID);
            }
            break;

        case DialogPartNodeActionType.ClearScene:
            byteList.Add(Opcode.CLEAR_SCENE);
            break;

        case DialogPartNodeActionType.EnterActor:

            break;

        case "Scenario Script":
            AddAudioCode(byteList, data);
            AddCurrentCode(byteList, textDialogHndStr);
            KAGInterpreter ip   = new KAGInterpreter();
            List <byte>    temp = ip.Interpret(data.dialogText);
            for (int i = 0; i < temp.Count; i++)
            {
                byteList.Add(temp[i]);
            }
            temp = null;
            break;

        case "Selections":
//				if( data.isSelections ){
            ByteCodeScriptTools.AddMessagingCode(byteList, "_", OpcodeMessaging.SELECTIONS);
            ByteCodeScriptTools.AddTextLiteralCode(byteList, "_");
            byteList.Add(Opcode.SELECTIONS);
            //			for( int i=0;i<units.Length;i++){
            //				SelectionsNode1.SelectUnit unit = units[ i ];
            //				CodeGenerator.GenerateASelection( byteList , i , data.targetNodeName , unit.text , false , "_" );
            //			}
            CodeGenerator.GenerateASelection(byteList, 0, data.selection.targetNodeName, data.selection.text, false, "_");

            byteList.Add(Opcode.STOP);
//				}
            break;
#endif
        }
    }