Ejemplo n.º 1
0
    public override void AddListener()
    {
        UI_Event ev = UI_Event.Get(btn1);

        ev.onClick = OnBtnClick;
        Debug.Log("init 2");
    }
Ejemplo n.º 2
0
    //add drag event
    void AddDragEvent(GameObject go)
    {
        UI_Event ev = UI_Event.Get(go);

        ev.onDown += OnDown;
        ev.onUp   += OnUp;
        ev.onDrag += OnDrag;
    }
Ejemplo n.º 3
0
    public override void Init()
    {
        base.Init();

        UI_Event ev = UI_Event.Get(mButton);

        ev.onClick = ButtonOnClick;
    }
Ejemplo n.º 4
0
    public override void Init()
    {
        base.Init();
        mBtnPersonal.onClick = BtnPersonalOnClick;
        mBtnSidebar.onClick  = BtnSidebarOnClick;
        mBtnAddNew.onClick   = BtnAddNewOnClick;

        UI_Event _event = UI_Event.Get(mView);

        _event.onBeginDrag = BtnItemOnBeginDrag;
        _event.onDrag      = BtnItemOnDrag;
        _event.onEndDrag   = BtnItemOnEndDrag;
    }
Ejemplo n.º 5
0
    public override void OpenScreen()
    {
        base.OpenScreen();
        List <TableMissionSelect.Data> lst_mis_table = TableManager.instance.GetMissionSelectAll();
        List <Mission> lst_mis = new List <Mission>();

        for (int i = 0; i < lst_mis_table.Count; i++)
        {
            Mission _mis = new Mission();
            _mis.mTextureName = lst_mis_table[i].mPic;
            _mis.mDesc        = lst_mis_table[i].mDesc;
            lst_mis.Add(_mis);
        }
        SetSelectMission(lst_mis);

        UI_Event view_event = UI_Event.Get(mView);

        view_event.onBeginDrag = ScrollOnBeginDrag;
        view_event.onDrag      = ScrollOnDrag;
        view_event.onEndDrag   = ScrollOnEndDrag;
    }
    void Start()
    {
        UI_Event e = UI_Event.Get(button);

        e.onClick = button_click;
    }
    public void Refresh()
    {
        this.m_fMove_rate     = 1;
        this.m_fMove_speed    = 0;
        this.m_iMoveDir       = 1;
        this.m_fMoveStartTime = 0;
        this.m_bDrag          = false;
        this.m_bFixPos        = false;
        this.m_cFixObj        = null;
        this.m_fFixSpeed      = 0;

        // this.Size = this.ScrollItems[0].rect.width;
        MaxPos = (int)(0 + this.Size * (this.ScrollItems.Count - this.LeftCount));
        MinPos = (int)(0 - this.Size * (this.ScrollItems.Count - this.RightCount));

        RepositionMax = (int)(0 + this.Size * (this.RightCount));
        RepositionMin = (int)(0 - this.Size * (this.LeftCount));

        for (int i = this.StartIndex; i < this.ScrollItems.Count - this.LeftCount; i++)
        {
            if (moveType == Movement.Horizontal)
            {
                this.ScrollItems[i - this.StartIndex].transform.localPosition = new Vector3((i - this.StartIndex) * this.Size, 0, 0);
            }
            else
            {
                this.ScrollItems[i - this.StartIndex].transform.localPosition = new Vector3(0, (i - this.StartIndex) * this.Size, 0);
            }
        }
        for (int i = 0; i < this.LeftCount; i++)
        {
            int index = this.StartIndex - 1 - i;
            if (index < 0)
            {
                index = this.ScrollItems.Count + index;
            }
            if (moveType == Movement.Horizontal)
            {
                this.ScrollItems[index].transform.localPosition = new Vector3((i + 1) * this.Size * -1, 0, 0);
            }
            else
            {
                this.ScrollItems[index].transform.localPosition = new Vector3(0, (i + 1) * this.Size * -1, 0);
            }
        }

        //regist event
        for (int i = 0; i < ScrollItems.Count; i++)
        {
            GameObject go = ScrollItems[i];
            UI_Event   ev = UI_Event.Get(go);
            ev.onDown += OnDown;
            ev.onUp   += OnUp;
            ev.onDrag += OnDrag;
        }

        //calculate move rate
        Transform node = this.transform;

        while (true)
        {
            CanvasScaler cs = node.GetComponent <CanvasScaler>();
            if (cs != null)
            {
                this.m_fMove_rate = cs.referenceResolution.x / Screen.width;
                break;
            }
            node = node.parent;
            if (node == null)
            {
                break;
            }
        }
    }
Ejemplo n.º 8
0
    public override void AddListener()
    {
        UI_Event ev = UI_Event.Get(btn_play);

        ev.onClick = OnClickBtnPlay;
    }