Beispiel #1
0
    public static UIListener SetUIOnClick(GameObject go, Action <GameObject> callBack)
    {
        var uiL = UIListener.GetUIListener(go);

        uiL.AddClick(callBack);
        return(uiL);
    }
Beispiel #2
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 #3
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 #4
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 #5
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 #6
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 #7
0
    public void AddUIButton(string path, Action <GameObject> callBack)
    {
        UIListener uiListener = UIListener.GetUIListener(go.transform.Find(path).gameObject);

        uiListener.AddClick(callBack);
    }
Beispiel #8
0
    void OnClickRole(GameObject go)
    {
        RoleBase role = UIListener.GetUIListener(go).param as RoleBase;

        wndTips.ShowRoleInfo(role, WndTips.RoleInfoType.Fight);
    }