Ejemplo n.º 1
0
    public void Init(DishClientCore _core, DishRequirement _requirement)
    {
        Init(_core);

        requirement = _requirement;

        int column = (requirement.dishArr.Length + 1) / 2;

        (transform as RectTransform).SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, column * 35 + (column + 1) * 10);

        for (int i = 0; i < requirement.dishArr.Length; i++)
        {
            GameObject go = GameObjectFactory.Instance.GetGameObject("Assets/Resource/prefab/requirementUnit.prefab", null);

            RequirementUnit unit = go.GetComponent <RequirementUnit>();

            unit.Init(requirement.dishArr[i]);

            go.transform.SetParent(transform, false);

            float x = 10 + i / 2 * 45;

            float y = -10 - i % 2 * 45;

            (go.transform as RectTransform).anchoredPosition = new Vector2(x, y);
        }
    }
Ejemplo n.º 2
0
    public void Init(DishClientCore _core, int _index, bool _canControl)
    {
        Init(_core);

        index = _index;

        img.raycastTarget = _canControl;
    }
Ejemplo n.º 3
0
    public void Init(DishClientCore _core, List <DishRequirement> _dataList)
    {
        core = _core;

        dataList = _dataList;

        moveDisPerTick = max_length / (CookConst.REQUIRE_EXCEED_TIME * CookConst.TICK_NUM_PER_SECOND);
    }
Ejemplo n.º 4
0
    public void Init(DishClientCore _core, DishResult _dishResult)
    {
        base.Init(_core);

        dishResult = _dishResult;

        exceedTime = dishResult.sds.GetExceedTime() * CookConst.TICK_NUM_PER_SECOND;

        TextureFactory.Instance.GetTexture <Sprite>("Assets/Resource/texture/" + (dishResult.sds as ResultSDS).icon + ".png", GetSprite, true);

        timeIcon.fillAmount = dishResult.time / exceedTime;

        RefreshIsOptimized();
    }
Ejemplo n.º 5
0
    public void Init(DishClientCore _core, bool _canControl)
    {
        core = _core;

        canControl = _canControl;

        trashContainer.Init(core);

        for (int i = 0; i < CookConst.RESULT_STATE.Length; i++)
        {
            GameObject go = GameObjectFactory.Instance.GetGameObject("Assets/Resource/prefab/resultContainer.prefab", null);

            go.transform.SetParent(dishResultContainer, false);

            (go.transform as RectTransform).anchoredPosition = new Vector2(i * dishResultGap, 0);

            DishResultContainer drc = go.GetComponent <DishResultContainer>();

            drc.Init(core, i, canControl);

            dishResultContainerArr[i] = drc;
        }

        for (int i = 0; i < CookConst.WORKER_NUM; i++)
        {
            GameObject go = GameObjectFactory.Instance.GetGameObject("Assets/Resource/prefab/workerUnit.prefab", null);

            WorkerUnit workerUnit = go.GetComponent <WorkerUnit>();

            workerArr[i] = workerUnit;

            workerUnit.Init(core, i);

            go = GameObjectFactory.Instance.GetGameObject("Assets/Resource/prefab/seat.prefab", null);

            go.transform.SetParent(seatContainer, false);

            (go.transform as RectTransform).anchoredPosition = new Vector2(i * seatGap, 0);

            SeatUnit seatUnit = go.GetComponent <SeatUnit>();

            seatUnit.Init(core, -i - 1, canControl);

            seatArr[i] = seatUnit;

            seatUnit.SetWorker(workerArr[i]);
        }
    }
Ejemplo n.º 6
0
    public void Init(DishClientCore _core, int _index, bool _canControl)
    {
        Init(_core);

        index = _index;

        bool b = CookConst.RESULT_STATE[index];

        string path = b ? "Assets/Resource/texture/a.png" : "Assets/Resource/texture/b.png";

        TextureFactory.Instance.GetTexture <Sprite>(path, GetSprite, true);

        if (!_canControl)
        {
            bg.raycastTarget = false;
        }
    }
Ejemplo n.º 7
0
 public virtual void Init(DishClientCore _core)
 {
     core = _core;
 }
Ejemplo n.º 8
0
    public void Init(DishClientCore _core, Dish _dish)
    {
        Init(_core);

        dish = _dish;
    }
Ejemplo n.º 9
0
    public void Init(DishClientCore _core)
    {
        core = _core;

        SetSelected(false);
    }
Ejemplo n.º 10
0
    public void Init(DishClientCore _core, int _index)
    {
        base.Init(_core);

        index = _index;
    }
Ejemplo n.º 11
0
    public void Init(DishClientCore _core, DishData _dishData, int _index, bool _canControl)
    {
        dishData = _dishData;

        index = _index;

        core = _core;

        dishResultBt.Init(core, this);

        dishWorkerBt.Init(core, index, _canControl);

        if (!_canControl)
        {
            for (int i = 0; i < controlGraphic.Length; i++)
            {
                controlGraphic[i].raycastTarget = false;
            }
        }

        float time = dishData.sds.GetPrepareTime() + dishData.sds.GetCookTime() + dishData.sds.GetOptimizeTime();

        container.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, time / DishClientCore.MAX_TIME * MAX_LENGTH);

        prepare.Init(dishData.sds.GetPrepareTime());

        float prepareLength = dishData.sds.GetPrepareTime() / DishClientCore.MAX_TIME * MAX_LENGTH;

        (prepare.transform as RectTransform).SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, prepareLength);

        float cookLength = 0;

        if (dishData.sds.GetCookTime() > 0)
        {
            if (!cook.gameObject.activeSelf)
            {
                cook.gameObject.SetActive(true);
            }

            cook.Init(dishData.sds.GetCookTime());

            cookLength = dishData.sds.GetCookTime() / DishClientCore.MAX_TIME * MAX_LENGTH;

            (cook.transform as RectTransform).SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, cookLength);

            (cook.transform as RectTransform).anchoredPosition = new Vector2(prepareLength, 0);
        }
        else
        {
            if (cook.gameObject.activeSelf)
            {
                cook.gameObject.SetActive(false);
            }
        }

        optimize.Init(dishData.sds.GetOptimizeTime());

        float optimizeLength = dishData.sds.GetOptimizeTime() / DishClientCore.MAX_TIME * MAX_LENGTH;

        (optimize.transform as RectTransform).SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, optimizeLength);

        (optimize.transform as RectTransform).anchoredPosition = new Vector2(prepareLength + cookLength, 0);

        TextureFactory.Instance.GetTexture <Sprite>("Assets/Resource/texture/" + (dishData.sds.GetResult() as ResultSDS).icon + ".png", GetSprite, true);

        if (dishData.result != null)
        {
            DishResultAppear();
        }
    }