Example #1
0
File: thePlot.cs Project: BXZR/GAL
    //全体剧本树的初始化在这里完成
    //完全自动化处理,只需要在控制面板里面处理好相应的父子关系就可以了
    //初始化第二阶段
    public void InitTheTree(TextAsset thePlot)
    {
        Transform theRoot = theTreeMake.makeATree(thePlot);

        theRoot.transform.SetParent(this.transform);
        //this.GetComponent <allStartController> ().makeATree ();
        int count = this.transform.childCount;

        for (int i = 0; i < count; i++)
        {
            Transform theChild = this.transform.GetChild(i);
            if (theChild.GetComponent <thePlotItem> ())
            {
                thePlotItem theItem = theChild.GetComponent <thePlotItem> ();
                roots.Add(theItem);
                theItem.makeStart();                 //递归初始化
            }
        }

        theItemNow       = theRoot.GetComponent <thePlotItem> (); //初始化当前处理的项目
        watiForSkipTimer = theItemNow.waitTimeForAutoSkip;
    }
Example #2
0
File: thePlot.cs Project: BXZR/GAL
//操作剧本树单元的方法,这个程序真正用来玩的方法
//事实上,这个方法只会对单个分支节点生效
    public void playTheItem(thePlotItem theItem = null)
    {
        //简单的防护措施
        if (theItem == null)
        {
            //额外的文件处理
            //既然已经完成了,就保存一下吧
            systemInformations.SaveTheOverPlot();
            CGModeFile.saveCGFile();
            SceneModeFile.saveSceneFile();
            extraHFile.saveHExtra();

            //print ("没有可控制的剧本元素");
            SceneManager.LoadScene("start");
            return;
        }
        //尝试激活Scene
        //规则是当一个剧本帧的下标到达了某一个scene的最后一个下标,那么这个scerne就可以被解锁
        SceneModeFile.activeScene(theItem.ThePlotItemID);
        //每一次新跑一个剧本帧的时候才会真的初始化这个剧本帧的儿子节点
        //性能消耗均摊,这样看上去要比初始化的时候气归初始化要好一点
        theItem.makeStart();
        theItemNow       = theItem;
        watiForSkipTimer = theItemNow.waitTimeForAutoSkip;

        //各种控制单元对这个单元的操作
        theTextController.setTheString(theItem);
        theUIController.makeShow(theItem);
        //print ("theMusicController name is " + theMusicController.gameObject.name);
        theMusicController.playBackMusic(theItem);
        theSoundController.playSound(theItem);
        thePeopleSoundController.playSound(theItem, true);

        //剧本帧完成之后这些计算才能生效
        //剧本完成度控制
        systemInformations.addPlotOverPercent(theItem);
        //好感度控制
        theItem.makeAddLoveValue();
    }