Exemplo n.º 1
0
    public override void NextMessage()
    {
        if (blink != null)
        {
            blink.DontShow();
        }

        if (!ViNo.isLockNextMessage)
        {
            if (useTextAfterEffect)
            {
                if (!reachedEnd)
                {
                    ViNo.NextMessage();
                }
                else
                {
                    DoTextAfterEffect();
                }
            }
            else
            {
                ViNo.NextMessage();
            }
        }
    }
Exemplo n.º 2
0
    void Start()
    {
        if (info == null)
        {
            info = ScriptableObject.CreateInstance <ViNoSaveInfo>();
        }

        m_FileExists = ExternalAccessor.IsSaveDataFileExists(fileName);
        if (m_FileExists)
        {
            // Load SaveInfo from Storage.
            ViNo.LoadDataFromStorage(fileName, ref info);
            UpdateText(info.data.m_Date, info.data.m_ScenarioDescription);
        }
        else
        {
            UpdateText("", "NO DATA");
        }

// NGUI Dependency...
#if false
        // Load Mode.
        if (!SystemUIEvent.saveMode)
        {
            continueButton.isEnabled = m_FileExists;
        }
#endif
    }
Exemplo n.º 3
0
 void DoSave(bool t)
 {
     if (t)
     {
         ViNo.SaveData(fileName, info);
         UpdateText(info.data.m_Date, info.data.m_ScenarioDescription);
     }
 }
Exemplo n.º 4
0
    // if save Succeeded , then return true.
    static public bool DoQuickSave()
    {
        ViNoSaveInfo info = ScenarioCtrl.Instance.quickSaveSlot;        //Info;

        if (info == null)
        {
            Debug.LogError("ScenarioCtrl not attached QuickSaveSlot. couldn't Save.");
            return(false);
        }
        else
        {
            return(ViNo.SaveData("QSaveData", info));
        }
    }
Exemplo n.º 5
0
    static public bool DoQuickLoad()
    {
        SystemUtility.ClearAllTextBoxMessage();
        ViNoSaveInfo info = ScenarioCtrl.Instance.quickSaveSlot;

        if (info != null)
        {
            return(ViNo.LoadData("QSaveData", ref info));
        }
        else
        {
            Debug.LogError("ScenarioCtrl not attached QuickSaveSlot. couldn't Load.");
            return(false);
        }
    }
Exemplo n.º 6
0
    static public bool CheckQuickSaveFileAndLoadFromStorage()
    {
        bool isQuickSaveFileExists = ExternalAccessor.IsSaveDataFileExists(k_QuickSaveFileName);

        if (isQuickSaveFileExists)
        {
            ScenarioCtrl sc = ScenarioCtrl.Instance;
            // Load SaveInfo from Storage.
            ViNo.LoadDataFromStorage(k_QuickSaveFileName, ref sc.quickSaveSlot);
        }
        else
        {
            Debug.LogWarning("Quick Save File not exists.");
        }

        return(isQuickSaveFileExists);
    }
Exemplo n.º 7
0
    /// <summary>
    /// Loads the data.
    /// </summary>
    static public bool LoadData(string fileName, ref ViNoSaveInfo info)
    {
//		IScriptEngine vino =  IScriptEngine.Instance;
        ScenarioNode scenario = ScenarioNode.Instance;

        if (scenario != null)
        {
//			if( vino.saveToExternalFile ){
            // Load Flag Data from Storage.
//				FlagTable.FlagUnit[] flags = LoadFlagTable( fileName );
            FlagTableData flagData = LoadFlagTable(fileName);
            if (scenario.flagTable != null)
            {
#if false
//					scenario.flagTable.flags = flags;
#else
                scenario.flagTable.flags        = flagData.flags;
                scenario.flagTable.stringValues = flagData.stringValues;
#endif
            }
            else
            {
                Debug.LogWarning("ScenarioNode.Instance " + scenario.name + " flagTable Not attached.");
            }

            // Load SaveData from Storage.
            LoadDataFromStorage(fileName, ref info);
            return(ViNo.Load(info));
//			}

/*			else{
 *                              return ViNo.Load( info );
 *                      }
 * //*/
        }
        else
        {
            Debug.LogWarning("ScenarioNode instance NOT FOUND.");
            return(false);
        }
    }
Exemplo n.º 8
0
    IEnumerator TextAfterEffectAndNextMessage( )
    {
        ViNo.LockNextMessage();

        if (textAfterEffect != null)
        {
            textAfterEffect.Preview();
        }

        // Wait Until the Text After Effect is Finished.
        if (textAfterEffect != null)
        {
            yield return(new WaitForSeconds(textAfterEffect.duration / 1000f));
        }
        else
        {
            yield return(new WaitForSeconds(0.001f));
        }

        ViNo.UnlockNextMessage();
        ViNo.NextMessage();
    }
Exemplo n.º 9
0
    /// <summary>
    /// Saves the data. if a Scenario is Played.
    /// </summary>
    static public bool SaveData(string fileName, ViNoSaveInfo info)
    {
        ScenarioNode scenario = ScenarioNode.Instance;

        if (scenario != null)
        {
//			if( vino.saveToExternalFile ){
            // ScenarioNode has a ViNoSaveInfo. saveInfo is a ScriptableObject Data.
            ViNo.SaveToExternalFile(fileName, info, scenario.flagTable);

/*			}
 *                      else{
 *                              ViNo.Save( info );
 *                      }
 * //*/
            return(true);
        }
        else
        {
            Debug.LogWarning("ScenarioNode instance NOT FOUND.");
            return(false);
        }
    }
Exemplo n.º 10
0
    static public GameObject GetViNoObject( )
    {
#if false
        GameObject vinoObj = GameObject.Find("ViNo");
        if (vinoObj == null)
        {
            vinoObj = new GameObject("ViNo");
            vinoObj.AddComponent <ViNo>();
        }
        return(vinoObj);
#else
        ViNo vino = GameObject.FindObjectOfType(typeof(ViNo)) as ViNo;
        if (vino == null)
        {
            GameObject vinoObj = new GameObject("ViNo");
            vinoObj.AddComponent <ViNo>();
            return(vinoObj);
        }
        else
        {
            return(vino.gameObject);
        }
#endif
    }
Exemplo n.º 11
0
    public override void OnGUICustom()
    {
        m_AreaRect = new Rect(Screen.width - m_AreaWidth, 0f, m_AreaWidth, Screen.height);
        GUILayout.BeginArea(m_AreaRect);

        if (quickMenuTex != null)
        {
            if (GUILayout.Button(quickMenuTex))
            {
                m_ShowMenu = !m_ShowMenu;
            }
        }
        else
        {
            if (GUILayout.Button("Menu", GUILayout.Height(m_ButtonHeight)))
            {
                m_ShowMenu = !m_ShowMenu;
            }
        }

        GUILayout.Space(m_VerticalSpace);

        if (m_ShowMenu)
        {
// TODO.
#if true
            if (GUILayout.Button("QuickSave", GUILayout.Height(m_ButtonHeight)))
            {
                Debug.Log("Quick Save");
                if (statusLabel != null)
                {
                    statusLabel.text = "Saved !";
                }
                if (ViNoAPI.DoQuickSave())
                {
                    Debug.Log("Quick Save succeeded");
                }
            }

            GUILayout.Space(m_VerticalSpace);

            if (GUILayout.Button("QuickLoad", GUILayout.Height(m_ButtonHeight)))
            {
                Debug.Log("Quick Load");
                if (statusLabel != null)
                {
                    statusLabel.text = "Load !";
                }
                if (ViNoAPI.DoQuickSave())
                {
                    Debug.Log("Quick Load succeeded");
                }
            }
#endif
            GUILayout.Space(m_VerticalSpace);

            if (GUILayout.Button("Back Log", GUILayout.Height(m_ButtonHeight)))
            {
                ViNo.ToggleShowBackLog();

                sampleGUI.EnableShowBackLog(true);
                sampleGUI.EnableShowQuickMenu(false);
                sampleGUI.EnableShowNextMessage(false);

                m_ShowMenu = false;
            }

            GUILayout.Space(m_VerticalSpace);
        }

        GUILayout.EndArea();
    }
Exemplo n.º 12
0
 static public bool DoQuickLoad()
 {
     return(ViNo.DoQuickLoad());
 }
Exemplo n.º 13
0
 static public bool DoQuickSave()
 {
     return(ViNo.DoQuickSave());
 }
Exemplo n.º 14
0
 static public bool SaveData(string fileName, ViNoSaveInfo info)
 {
     return(ViNo.SaveData(fileName, info));
 }
Exemplo n.º 15
0
    /// <summary>
    /// If Playing a ScenarioNode , then the Played Scenario is the Instance.
    /// </summary>
    public void Play()
    {
        CheckInstance();

        SystemUtility.ClearAllTextBoxMessage();

        VM vm = VM.Instance;

        vm.currentScenarioName = gameObject.name;

        // ScenarioScript Mode.

/*		if( useScenarioScript ){
 *                      ViNoToolkit.KAGInterpreter kag = new ViNoToolkit.KAGInterpreter();
 *                      List<byte> byteList = kag.Interpret( scenarioScript.text );
 *                      ByteCodes btcodes = new ByteCodes( byteList.ToArray() );
 *
 *                      btcodes.Add( Opcode.END );
 *
 *                      vm.SetCode( btcodes.GetCode() );
 *              }
 * //*/
        // Default Mode.
//		else{
        ByteCodes btcodes = null;

        if (startNode.gameObject == this.gameObject)
        {
            btcodes = new ByteCodes();
            btcodes.Init();
#if true
            startNode.ToByteCode(btcodes);
#else
            TEST_ADD_CODE(btcodes, GetComponents <ViNode>());
#endif
        }
        else
        {
            btcodes = Compile();                    //useCompiledScript ? new ByteCodes( compiledScriptFile.bytes ) : Compile();
        }

        btcodes.Add(Opcode.END);

        vm.SetCode(btcodes.GetCode());
//		}

        if (startFromSave)
        {
            //if ScenarioCtrl exists in this scene, then loaddata from that info.
            ScenarioCtrl sc = ScenarioCtrl.Instance;
            if (sc != null)
            {
                ViNo.LoadData(sc.fileName, ref sc.saveInfo);
            }
        }
        else
        {
            if (useScenarioScript)
            {
                vm.Run();
            }
            else
            {
                if (startNode == null)
                {
                    vm.Run();
                }
                else
                {
                    PlayFromStartNode();
                }
            }
        }
    }
Exemplo n.º 16
0
 void OnClickNextMessage( )
 {
     ViNo.NextMessage();
 }