Inheritance: MonoBehaviour
Beispiel #1
0
 public void OnAccelerateCar(GameObject go)
 {
     UIListener.SetBtnStatus(go, false);
     IsAccelerate = true;
     SpeedTemp    = currentspeed;//保存发射前速度
     currentspeed = DataManager.Instance.PlayerCarShootSpeed;
 }
Beispiel #2
0
    public static UIListener SetUIOnClick(GameObject go, Action <GameObject> callBack)
    {
        var uiL = UIListener.GetUIListener(go);

        uiL.AddClick(callBack);
        return(uiL);
    }
Beispiel #3
0
    void ShowTalentList()
    {
        //现在还在屏幕右边

        //移动过来,然后监听点击移出去,移出去之后监听移出
        talentListRect.DOAnchorPosX(targetTalentListX, 0.8f);

        int childCount  = talentContent.childCount;
        int talentCount = playerModel.talents.Count;

        if (childCount < talentCount)
        {
            int chaZhi = talentCount - childCount;

            for (int i = 0; i < chaZhi; i++)
            {
                var go = GameObject.Instantiate(talentItem, talentContent);
                UIUtil.SetUIOnClick(go, OnClickTalent);
            }
        }

        for (int i = 0; i < talentCount; i++)
        {
            var t  = playerModel.talents[i];
            var go = talentContent.GetChild(i).gameObject;
            go.transform.Find("nameText").GetComponent <Text>().text = t.name;
            go.SetActive(true);
            UIListener.GetUIListener(go).param = t;
        }
        for (int i = talentCount; i < childCount; i++)
        {
            talentListRect.GetChild(i).gameObject.SetActive(false);
        }
    }
Beispiel #4
0
    public override void OnShow()
    {
        base.OnShow();

        AudioManager.instance.PlayBGM(ConstConfig.WndFightBg);
        UpdateSpeedText();

        AddEvent();

        fightManager.BeginFight(playerModel.fightRoles, aiModel.fightRoles, playerRoleGos, aiRoleGos);

        RolesToFightPos();

        TimeManager.Regist((id) =>
        {
            fightManager.StartFight();
        }, 1.2f, 0, 1);


        for (int i = 0; i < 9; i++)
        {
            RoleBase pRole = playerModel.fightRoles[i];
            RoleBase aRole = aiModel.fightRoles[i];

            UIListener.GetUIListener(playerRoleGos[i]).param = pRole;

            UIListener.GetUIListener(aiRoleGos[i]).param = aRole;
        }
    }
Beispiel #5
0
    static public UIListener Get(Transform trans)
    {
        UIListener listener = trans.GetComponent <UIListener>();

        if (listener == null)
        {
            listener = trans.gameObject.AddComponent <UIListener>();
        }
        return(listener);
    }
Beispiel #6
0
    static public UIListener Get(GameObject go)
    {
        UIListener listener = go.GetComponent <UIListener>();

        if (listener == null)
        {
            listener = go.AddComponent <UIListener>();
        }
        return(listener);
    }
Beispiel #7
0
    static public UIListener Get(Component com)
    {
        UIListener listener = com.GetComponent <UIListener>();

        if (listener == null)
        {
            listener = com.gameObject.AddComponent <UIListener>();
        }
        return(listener);
    }
Beispiel #8
0
    public void OnBeginDrag(PointerEventData eventData)
    {
        listener = GetComponent <UIListener>();

        this.EventData = eventData;

        dragTime = 0;

        onBeginDrag?.Invoke(gameObject);
    }
Beispiel #9
0
    static public UIListener Get(Component com, object data)
    {
        UIListener listener = com.GetComponent <UIListener>();

        if (listener == null)
        {
            listener = com.gameObject.AddComponent <UIListener>();
        }
        listener.data = data;
        return(listener);
    }
Beispiel #10
0
    static public UIListener Get(GameObject go, object data)
    {
        UIListener listener = go.GetComponent <UIListener>();

        if (listener == null)
        {
            listener = go.AddComponent <UIListener>();
        }
        listener.data = data;
        return(listener);
    }
Beispiel #11
0
    void Start()
    {
        source          = GetComponent <AudioSource>();
        ammunitionCount = magazineSize;
        shootTimer      = 0;
        reloadTimer     = 0;

        // Set EventListener for ammunition display (UI)
        UIListener uiListen = GameObject.Find("UI").GetComponent <UIListener>();

        ammunitionPercentageUpdate.AddListener((percentage) => { uiListen.updateAmmunition(percentage); });
    }
Beispiel #12
0
    //被点击后调用
    void ShowEquip(GameObject go)
    {
        //image透明度变化


        var   uiL = UIListener.GetUIListener(go);
        Equip e   = uiL.param as Equip;
        //显示装备图片
        //image显示
        var image = go.GetComponent <Image>();

        image.DOColor(Color.clear, 1f).OnComplete(
            () =>
        {
            var equipImage = go.transform.GetChild(0).GetComponent <Image>();
            equipImage.gameObject.SetActive(true);
            equipImage.sprite = ResourceManager.LoadAsset <Sprite>(ResourceManager.EquipPath + e.id.ToString(), e.id.ToString());
        }
            );
        //添加点击显示信息
        UIUtil.SetUIOnClick(go, (g) => { ViewManager.Get <WndTips>("WndTips").ShowInfo(e.desc); });
    }
Beispiel #13
0
        public void Init(string name, Mogre.RenderWindow window, InputContext inputContext, UIListener listener)
        {
            Name              = name;
            this.window       = window;
            this.inputContext = inputContext;
            this.listener     = listener;
            cursorWasVisible  = false;

            OverlayManager om       = Mogre.OverlayManager.Singleton;
            string         nameBase = Name + "/";

            cursorLayer        = om.Create(nameBase + "CursorLayer");
            cursorLayer.ZOrder = 1;

            // make backdrop and cursor overlay containers
            cursor = (Mogre.OverlayContainer)om.CreateOverlayElementFromTemplate("SdkTrays/Cursor", "Panel", nameBase + "Cursor");
            cursorLayer.Add2D(cursor);
            cursorLayer.ZOrder = 400;

            ShowCursor();
            gameCursor = new GameCursor();
        }
Beispiel #14
0
    /// <summary>
    /// 复活一个挂掉的角色
    /// </summary>
    /// <param name="role"></param>
    public void ResuscitateFightRole(RoleBase role)
    {
        //role.BackAllValue(); //复活后属性要回退到初始状态
        role.BeginFight(role.WholeHurtValue);

        //先找个位置
        int index = -1;

        for (int i = 0; i < role.team.Length; i++)
        {
            if (role.team[i] == null)
            {
                index = i;
                break;
            }
        }
        if (index != -1)
        {
            //送回去
            role.team[index] = role;
            role.SetFightPositionIndex(index);
            if (role.fightListType == EnumType.FightListType.Player)
            {
                UIListener.GetUIListener(playerRoleGos[index]).param = role;
                role.SetFightGo(playerRoleGos[index]);

                playerDieRoles.Remove(role);
            }

            else if (role.fightListType == EnumType.FightListType.Ai)
            {
                UIListener.GetUIListener(aiRoleGos[index]).param = role;
                role.SetFightGo(aiRoleGos[index]);

                aiDieRoles.Remove(role);
            }
        }
    }
Beispiel #15
0
 internal void SetListener(UIListener listener)
 {
     CurrentLayer.SetListener(listener);
 }
Beispiel #16
0
 public Worker(UIListener parent, Options options, bool preview)
 {
     _parent = parent;
     _preview = preview;
     _options = options;
 }
    protected void OnClickDrag(GameObject go, System.Action <PointerEventData> cb)
    {
        UIListener listener = getOrAddComponet <UIListener>(go);

        listener.onClickDrag = cb;
    }
Beispiel #18
0
 //处理客户端丢失服务器传回的升级,精进和强化的包,客户端进行显示效果,并发送重新数据请求的包//
 public static void ContinueShow(GameObject go)
 {
     UIListener.Instance().OnReceiveMsg(true);
     NetworkSender.Instance().sendFinish(true);
     NetworkSender.Instance().GetUserInfo(null);
 }
Beispiel #19
0
 public void AssignListener(UIListener listener)
 {
     this.listener = listener;
 }
Beispiel #20
0
 public Widget()
 {
     trayLoc  = UIWidgetLocation.TL_NONE;
     element  = null;
     listener = null;
 }
Beispiel #21
0
    void OnClickRole(GameObject go)
    {
        RoleBase role = UIListener.GetUIListener(go).param as RoleBase;

        wndTips.ShowRoleInfo(role, WndTips.RoleInfoType.Fight);
    }
Beispiel #22
0
    void OnClickTalent(GameObject go)
    {
        var talent = UIListener.GetUIListener(go).param as MyTalent.Talent;

        wndTips.ShowInfo($"<size=35><color=red>{talent.desc}</color></size>");
    }
Beispiel #23
0
    public void AddUIButton(string path, Action <GameObject> callBack)
    {
        UIListener uiListener = UIListener.GetUIListener(go.transform.Find(path).gameObject);

        uiListener.AddClick(callBack);
    }