Beispiel #1
0
 /// <summary>
 /// 对于OPT算法的额外处理
 /// </summary>
 private void Is_OPT_RS()
 {
     steps = new List <int>();
     if (currentRS is RS_OPT)
     {
         isOPT = true;
         RS_OPT opt = currentRS as RS_OPT;
         steps = opt.PreCalculate();
         Initial();
     }
     else
     {
         isOPT = false;
     }
 }
Beispiel #2
0
    ///////////////////////////////////

    private void Start()
    {
        Initial();//可重复初始化的地方

        steps       = new List <int>();
        eventSystem = GameObject.Find("EventSystem").GetComponent <EventSystem>();

        position    = new Transform[count];
        position[0] = Instantiate(PageFrame_Prefab, rootOfPageFrame.position + new Vector3(2, 0, 0), Quaternion.identity, rootOfPageFrame.transform).transform;
        position[0].GetChild(0).GetComponent <TextMesh>().text = "0";
        for (int i = 1; i < count; ++i)
        {
            position[i] = Instantiate(PageFrame_Prefab, position[i - 1].position + new Vector3(2, 0, 0), Quaternion.identity, rootOfPageFrame.transform).transform;
            position[i].GetChild(0).GetComponent <TextMesh>().text = i + "";
        }
        rootOfPageFrame.position += new Vector3(-(count), 5, 0);

        if (currentRS is RS_OPT)
        {
            isOPT = true;
            RS_OPT opt = currentRS as RS_OPT;
            steps = opt.PreCalculate();
            Initial();
            //pages.Reverse();
            //currentRS = new RS_LRU(count);
            //for (int i = 0; i < pages.Count; ++i)
            //{

            //    if (!NextPage())//如果未存在于内存中
            //    {
            //        GetPos();
            //    }
            //    KeepRS();//维护算法状态
            //}
            //steps.Reverse();
            //Initial();
        }
        else
        {
            isOPT = false;
        }

        print("当前载入:" + currentRS.RS_Name);

        StartCoroutine(PageStream());
    }