示例#1
0
    private void InitDrawings()
    {
        MovingRange = UnitGO.transform.FindChild("MovingRange").gameObject;
        MovingArrow = UnitGO.transform.FindChild("MovingArrow").gameObject;
        SelectSign  = GameObject.Instantiate(MovingRange) as GameObject;
        SelectSign.transform.parent           = MovingRange.transform.parent;
        SelectSign.transform.localPosition    = Vector3.zero;
        SelectSign.transform.localEulerAngles = Vector3.zero;
        SelectSign.transform.localScale       = Vector3.one;
        SelectSign.SetActive(false);
        m_starRadiusDrawLine = SelectSign.AddComponent <TrollDrawCircle>();//星球大小
        m_starRadiusDrawLine.SetRadius(BaseData.radius);

        MovingRange.SetActive(false);
        m_movingRangeDrawLine = MovingRange.AddComponent <TrollDrawCircle>();//移动半径
        m_movingRangeDrawLine.SetRadius(BaseData.radius + BaseData.range);

        m_movingDrawArrow = MovingArrow.AddComponent <TrollDrawArrow>();//移动箭头
        m_movingDrawArrow.SetSourcePos(MovingArrow.transform.position);
        m_movingDrawArrow.SetSourceRadius(BaseData.radius);

        var opt = OptDragListener.Get(UIBtn.gameObject);

        opt.onDrag  = UpdateArrow;
        opt.onPress = SetArrowVisible;

        var cam = UIManager.I.GetUILogic <MapUIMgr>().MyCameraController;

        cam.onDrag  += OnCameraDrag;
        cam.onScale += OnCameraScaleChanged;
    }
示例#2
0
    protected override void OnResourceLoaded()
    {
        var parent = MogoWorld.m_dataMapManager.GetUnitStarById(MogoWorld.thePlayer.HeadQuarterId).UnitParent.parent;

        SyncCreateUIInstanceWithRootTransform(Resources[0], parent);
        ComfirmBtn      = FindTransform("EufloriaBtnOK").GetComponent <MogoUIBtn>();
        CancelBtn       = FindTransform("EufloriaBtnCancel").GetComponent <MogoUIBtn>();
        ReconSoldierBtn = FindTransform("ReconSoldierBtn").GetComponent <MogoUIBtn>();
        DeleteBtn       = FindTransform("EufloriaBtnDelete").GetComponent <MogoUIBtn>();
        PercentBtn      = FindTransform("PercentBtn").GetComponent <MogoUIBtn>();

        ComfirmBtn.ClickAction      = OnComfirmBtnClickHandler;
        CancelBtn.ClickAction       = OnCancelBtnClickHandler;
        ReconSoldierBtn.ClickAction = OnReconSoldierBtnClickHandler;
        DeleteBtn.ClickAction       = OnDeleteBtnClickHandler;

        ComfirmBtn.gameObject.SetActive(false);
        CancelBtn.gameObject.SetActive(false);
        ReconSoldierBtn.gameObject.SetActive(false);
        DeleteBtn.gameObject.SetActive(false);

        ComfirmBtn.SetText(LanguageData.GetContent(186));
        CancelBtn.SetText(LanguageData.GetContent(187));
        DeleteBtn.SetText(LanguageData.GetContent(188));

        var opt = OptDragListener.Get(PercentBtn.gameObject);

        opt.onDrag = UpdateArrow;

        ReconSoldierBtn.SetText(LanguageData.GetContent(182));
        ShowPercent(true);

        AddListeners();
    }
示例#3
0
    public static OptDragListener Get(GameObject gameObject)
    {
        var opt      = new OptDragListener();
        var listener = UIEventListener.Get(gameObject);

        listener.onDrag  = opt.OnThisDrag;
        listener.onPress = opt.OnThisPress;

        return(opt);
    }
示例#4
0
    private int[] LimitPos = new int[] { -70, 50, 260, -250 };//左右上下

    private void Start()
    {
        var lis = OptDragListener.Get(gameObject);

        lis.onDrag = OnThisDrag;
    }