예제 #1
0
    static public UIStageMenuFloorItem Create()
    {
        UIStageMenuFloorItem self = UIManager.Singleton.LoadUI <UIStageMenuFloorItem>("UI/UIStageMenuFloorItem", UIManager.Anchor.Center);

        return(self);
    }
예제 #2
0
    // 显示floor
    void UpdateFloorInfo(int stageId)
    {
        m_heleperBar.value = 0;

        StageMenu.Singleton.m_curStageId = stageId;

        StageDetailInfo stageDetailInfo = GameTable.StageInfoTableAsset.LookUp(stageId);

        if (null == stageDetailInfo)
        {
            return;
        }

        m_name.text = stageDetailInfo.m_name;

        List <int> floorList = new List <int>();

        foreach (int floorId in stageDetailInfo.m_floorList)
        {
            floorList.Add(floorId);
        }

        foreach (UIStageMenuFloorItem item in m_floorItemList)
        {
            item.Destroy();
        }

        m_floorItemList.Clear();

        int pos = 0;

        for (int i = floorList.Count - 1; i >= 0; i--)
        {
            int floorId = floorList[i];

            UIStageMenuFloorItem floorItem = UIStageMenuFloorItem.Create();

            // 设置 父物体
            floorItem.SetParent(m_grid.transform);
            // 设置名称
            floorItem.WindowRoot.transform.name = floorList[i].ToString();

            floorItem.Update(floorId);

            UIEventListener.Get(floorItem.WindowRoot.gameObject).onClick = OnChooseFloor;

            m_floorItemList.Add(floorItem);

            floorItem.WindowRoot.transform.LocalPositionX(600f);
            floorItem.WindowRoot.transform.LocalPositionY(pos * (-66.3f));
            floorItem.WindowRoot.transform.LocalPositionZ(0f);

            TweenPosition temp = floorItem.WindowRoot.transform.GetComponent <TweenPosition>();
            if (null == temp)
            {
                continue;
            }
            temp.delay = 0.03f * pos;

            Vector3 posV = floorItem.WindowRoot.transform.localPosition;
            posV.x = 0;

            TweenPosition.Begin(floorItem.WindowRoot, 0.5f, posV).method = UITweener.Method.EaseIn;

            pos++;
        }

        m_curType = (int)CurType.enFloorType;

        RefreshJoystickAutoMap();
    }