Ejemplo n.º 1
0
    void OnUpdateEnemy(object p1, object p2)
    {
        Enemy  e = (Enemy)p1;
        Slider s = _enemyNode.GetRef("HpSlider").GetComponent <Slider>();

        s.value = e.CreatureData.HpPercent;
    }
Ejemplo n.º 2
0
    void ShowNodeFight(object p1, object p2)
    {
        CreatureData cData = (CreatureData)p1;

        _nodeId = (int)p2;
        Image icon = _fightNode.GetRef("Icon").GetComponent <Image>();

        icon.sprite = GameResSys.Instance.GetCG(cData.Cg);

        Text detail1 = _fightNode.GetRef("Info1").GetComponent <Text>();

        detail1.text = GetPropertyDescription1(cData);
        Text detail2 = _fightNode.GetRef("Info2").GetComponent <Text>();

        detail2.text = GetPropertyDescription2(cData);


        Text enemyName = _fightNode.GetRef("Name").GetComponent <Text>();

        enemyName.text = cData.Name + " Lv" + cData.Lv.Value;

        Text des = _fightNode.GetRef("Des").GetComponent <Text>();

        des.text = cData.Description;

        _fightNode.gameObject.SetActive(true);
    }
Ejemplo n.º 3
0
    public override void InitUI(UINode rootNode)
    {
        base.InitUI(rootNode);
        _rootNode = rootNode;

        DontDestroyOnLoad(rootNode.gameObject);

        rootNode.gameObject.SetActive(false);
        rootNode.GetRef("Slider").GetComponent <Slider>().value = 0f;

        EventSys.Instance.AddHander(ViewEvent.LoadingShow, (param1, param2) =>
        {
            rootNode.GetRef("Slider").GetComponent <Slider>().value = 0f;
            rootNode.gameObject.SetActive(true);
        });
        EventSys.Instance.AddHander(ViewEvent.LoadingUpdate, (param1, param2) =>
        {
            float val = (float)param1;
            rootNode.GetRef("Slider").GetComponent <Slider>().value = val;
        });
        EventSys.Instance.AddHander(ViewEvent.LoadingHide, (param1, param2) =>
        {
            rootNode.GetRef("Slider").GetComponent <Slider>().value = 1f;
            rootNode.gameObject.SetActive(false);
        });
    }
Ejemplo n.º 4
0
    void OnStageWin(object p1, object p2)
    {
        List <Item> items   = (List <Item>)p1;
        Transform   content = _winNode.GetRef("Content");

        content.DestroyChildren();
        foreach (Item item in items)
        {
            GameObject newNodeObj = Instantiate(_modelNode.GetNode("RewardItem").gameObject, content);

            UINode newNode = newNodeObj.GetComponent <UINode>();
            Image  bg      = newNode.GetRef("Bg").GetComponent <Image>();
            bg.sprite = GameResSys.Instance.GetFrame(item.Lv.Value);
            Image icon = newNode.GetRef("Icon").GetComponent <Image>();
            icon.sprite = GameResSys.Instance.GetItem(item.Icon);
            Text itemName = newNode.GetRef("Name").GetComponent <Text>();
            itemName.text = item.Name;
            if (item.Count.Value > 1)
            {
                itemName.text = item.Name + " * " + item.Count.Value;
            }
            Text itemDes = newNode.GetRef("Des").GetComponent <Text>();
            itemDes.text = item.Description;

            newNodeObj.SetActive(true);
        }

        _winNode.gameObject.SetActive(true);
    }
Ejemplo n.º 5
0
    /// <summary>
    /// 地图上的英雄node的实例化
    /// </summary>
    /// <param name="heroData"></param>
    /// <param name="setDragIcon"></param>
    /// <returns></returns>
    GameObject InsHeroNode(HeroData heroData, bool setDragIcon)
    {
        GameObject go        = Instantiate(_heroNodeModel);
        UINode     uiNode    = go.GetComponent <UINode>();
        Image      nodeImage = uiNode.GetRef("Image").GetComponent <Image>();

        nodeImage.sprite = GameResSys.Instance.GetCard(heroData.Icon);

        Button btn = uiNode.GetRef("Image").GetComponent <Button>();

        if (btn == null)
        {
            btn = uiNode.GetRef("Image").gameObject.AddComponent <Button>();
        }
        btn.onClick.AddListener(() => { OnHerNodeClicked(heroData.Id); });

        Dragable drag = uiNode.GetRef("Image").gameObject.AddComponent <Dragable>();

        drag.ActionId    = heroData.Id;
        drag.OnDragStart = OnDrag;
        drag.Canv        = _stageCanvas;
        if (setDragIcon)
        {
            drag.DragIcon = GameResSys.Instance.GetItem(heroData.FightIcon);
        }
        drag.HasTail       = true;
        drag.TailSprite    = GameResSys.Instance.GetMask(GameConstants.CommonDragTail);
        drag.TailColor     = heroData.TheColor;
        drag.TailWidth     = 20;
        drag.IsDisableGray = true;

        return(go);
    }
Ejemplo n.º 6
0
    void RefreshItem(FightHero fh)
    {
        _itemNodeRoot.DestroyChildren();
        foreach (var pair in fh.Items)
        {
            Item       item = pair.Value;
            GameObject go   = Instantiate(_modelNode.GetNode("Item").gameObject);
            go.transform.SetParent(_itemNodeRoot);

            UINode itemNode = go.GetComponent <UINode>();
            Image  image    = itemNode.GetRef("Image").GetComponent <Image>();
            image.sprite = GameResSys.Instance.GetItem(item.Icon);
            Button btn = image.gameObject.AddComponent <Button>();
            btn.onClick.AddListener(() => { EventSys.Instance.AddEvent(InputEvent.FightItemClicked, item.Id); });
            Text num = itemNode.GetRef("Text").GetComponent <Text>();
            num.text          = item.Count.Value.ToString();
            num.raycastTarget = false;//避免遮挡
            if (item.UsableInFight)
            {
                if (item.JobLimited > 0 && item.JobLimited != ((HeroData)fh.CreatureData).Job)
                {
                    continue;
                }

                Dragable dragable = image.gameObject.AddComponent <Dragable>();
                dragable.HasTail     = true;
                dragable.TailSprite  = GameResSys.Instance.GetMask(GameConstants.CommonDragTail);
                dragable.TailColor   = item.TheColor;
                dragable.TailWidth   = 20;
                dragable.Canv        = _rootNode.GetComponent <Canvas>();
                dragable.ActionId    = item.Id;
                dragable.OnDragStart = OnDragFromItem;
            }
        }
    }
Ejemplo n.º 7
0
    void OnCreateFightView(object p1, object p2)
    {
        //create enemy
        List <Enemy> enemies = (List <Enemy>)p2;

        foreach (Enemy e in enemies)
        {
            Image cg = _enemyNode.GetRef("Cg").GetComponent <Image>();
            cg.sprite = GameResSys.Instance.GetCG(e.CreatureData.Cg);
            Slider s = _enemyNode.GetRef("HpSlider").GetComponent <Slider>();
            s.value = e.CreatureData.HpPercent;

            Dropable dropable = cg.gameObject.GetComponent <Dropable>();
            if (dropable == null)
            {
                dropable = cg.gameObject.AddComponent <Dropable>();
            }
            dropable.ActionId = e.InstanceId;
            dropable.OnDroped = OnDropOnEnemy;
        }

        //create heros
        Dictionary <int, FightHero> heros = (Dictionary <int, FightHero>)p1;

        _heroNodes = new Dictionary <int, Transform>();
        foreach (KeyValuePair <int, FightHero> pair in heros)
        {
            FightHero fh = pair.Value;

            GameObject go = Instantiate(_modelNode.GetNode("Hero").gameObject);
            go.transform.SetParent(_heroNodeRoot);

            UINode node = go.GetComponent <UINode>();
            SetHeroData(fh, node);
            node.GetRef("Hurt").gameObject.SetActive(false);
            node.GetRef("Supply").gameObject.SetActive(false);
            node.GetRef("MpSupply").gameObject.SetActive(false);
            node.GetRef("Selected").gameObject.SetActive(false);
            ShowHurt(node, -1);

            Dropable dropable = go.AddComponent <Dropable>();
            dropable.ActionId = fh.Id;
            dropable.OnDroped = OnDropOnHero;

            Button btn = node.GetRef("Icon").GetComponent <Image>().gameObject.AddComponent <Button>();
            btn.onClick.AddListener(() => { EventSys.Instance.AddEvent(InputEvent.FightSelectHero, fh.Id); });

            _heroNodes.Add(fh.Id, go.transform);
        }

        _rootNode.gameObject.SetActive(true);

        _winNode.gameObject.SetActive(false);
        _loseNode.gameObject.SetActive(false);
    }
Ejemplo n.º 8
0
    public override void InitUI(UINode rootNode)
    {
        base.InitUI(rootNode);
        Button btnLogin = rootNode.GetRef("ButtonFight").GetComponent <Button>();

        btnLogin.onClick.AddListener(OnBtnFightClicked);

        Button btnExit = rootNode.GetRef("ButtonExit").GetComponent <Button>();

        btnExit.onClick.AddListener(OnBtnExitClicked);
    }
Ejemplo n.º 9
0
    public override void InitUI(UINode rootNode)
    {
        base.InitUI(rootNode);

        _attBtn = rootNode.GetRef("AttackBtn");
        _attBtn.GetComponent <Button>().onClick.AddListener(OnAttackBtnClicked);
        _skillBtn = rootNode.GetRef("SkillBtn");
        _skillBtn.GetComponent <Button>().onClick.AddListener(OnSkillBtnClicked);
        _skillBtn.gameObject.AddComponent <ImageGray>().Gray = true;
        _petBtn = rootNode.GetRef("PetBtn");
        _petBtn.GetComponent <Button>().onClick.AddListener(OnPetBtnClicked);
        _petBtn.gameObject.AddComponent <ImageGray>().Gray = true;

        _rootNode = rootNode;
        _rootNode.gameObject.SetActive(false);

        _enemyNode = rootNode.GetNode("Enemy");
        GameObject enemyHurt = _enemyNode.GetRef("Hurt").gameObject;

        enemyHurt.SetActive(false);
        GameObject enemySupply = _enemyNode.GetRef("Supply").gameObject;

        enemySupply.SetActive(false);

        _modelNode = rootNode.GetNode("Models");

        _heroNodeRoot = rootNode.GetRef("HeroRoot");
        _itemNodeRoot = rootNode.GetRef("ItemsContent");

        _winNode = rootNode.GetNode("Win");
        _winNode.GetRef("Button").GetComponent <Button>().onClick.AddListener(OnWinConfirmed);
        _loseNode = rootNode.GetNode("Lose");
        _loseNode.GetRef("Button").GetComponent <Button>().onClick.AddListener(OnLoseConfirmed);

        ShowItemDes(string.Empty, null);

        EventSys.Instance.AddHander(ViewEvent.CreateFightView, OnCreateFightView);
        EventSys.Instance.AddHander(ViewEvent.SetSelectedHero, OnChangeHero);
        EventSys.Instance.AddHander(ViewEvent.FightUpdateRound, OnUpdateRound);
        EventSys.Instance.AddHander(ViewEvent.FightUpdateEnemyState, OnUpdateEnemy);
        EventSys.Instance.AddHander(ViewEvent.FightShowWin, OnShowWin);
        EventSys.Instance.AddHander(ViewEvent.FightHeroAttack, OnHeroAttack);
        EventSys.Instance.AddHander(ViewEvent.FightHeroHpSupply, OnHeroHpSupply);
        EventSys.Instance.AddHander(ViewEvent.FightHeroMpSupply, OnHeroMpSupply);
        EventSys.Instance.AddHander(ViewEvent.FightShowLose, OnShowLose);
        EventSys.Instance.AddHander(ViewEvent.FightWinReturnToStage, OnFinish);
        EventSys.Instance.AddHander(ViewEvent.FightChangeTurn, OnChangeTurn);
        EventSys.Instance.AddHander(ViewEvent.FightEnemyAttack, OnEnemyAttack);
        EventSys.Instance.AddHander(ViewEvent.FightUpdateHeroState, OnUpdateHero);
        EventSys.Instance.AddHander(ViewEvent.FightUpdateAllHeroState, OnUpdateAllHero);
        EventSys.Instance.AddHander(ViewEvent.FightLoseReturnToStage, OnFinish);
        EventSys.Instance.AddHander(ViewEvent.FightShowTipNotSupportYet, ShowTipNotSupportYet);
        EventSys.Instance.AddHander(ViewEvent.FightShowItemDes, ShowItemDes);
    }
Ejemplo n.º 10
0
    void SetHeroData(FightHero fightHero, UINode node)
    {
        Image ico = node.GetRef("Icon").GetComponent <Image>();

        ico.sprite = GameResSys.Instance.GetCard(fightHero.CreatureData.Icon);
        Slider hs = node.GetRef("HpSlider").GetComponent <Slider>();

        hs.value = fightHero.CreatureData.HpPercent;
        Slider ms = node.GetRef("MpSlider").GetComponent <Slider>();

        ms.value = fightHero.CreatureData.MpPercent;
    }
Ejemplo n.º 11
0
    void OnFightStateMapping(object p1, object p2)
    {
        CatDebug.LogFunc();

        Transform hsl = _stageNode.GetRef("HeroSelectList");

        hsl.gameObject.SetActive(false);

        Transform readyBtn = _stageNode.GetRef("ButtonReady");

        readyBtn.gameObject.SetActive(false);

        foreach (KeyValuePair <int, Transform> pair in _nodeUIs)
        {
            Dropable dropable = pair.Value.GetComponentInChildren <Dropable>();
            dropable.enabled = true;
        }

        Dictionary <int, FightHero> heroes = (Dictionary <int, FightHero>)p1;

        foreach (KeyValuePair <int, Transform> pair in _fightHeroNodes)
        {
            Dragable dragable = pair.Value.GetComponentInChildren <Dragable>();
            HeroData hd       = (HeroData)heroes[pair.Key].CreatureData;
            dragable.DragIcon = GameResSys.Instance.GetItem(hd.FightIcon);
        }

        //create hero show list
        CreateHeroShowList(heroes);
    }
Ejemplo n.º 12
0
    void OnCreateHeroStartNode(object p1, object p2)
    {
        CatDebug.LogFunc();

        HeroData heroData     = (HeroData)p1;
        int      targetNodeId = (int)p2;

        if (_heroSelectNodes.ContainsKey(heroData.Id))
        {
            Dragable d = _heroSelectNodes[heroData.Id].GetComponentInChildren <Dragable>();
            d.SetEnable(false);
        }

        GameObject go = InsHeroNode(heroData, false);//这里的英雄还可能与其他英雄交换,故不添加特殊dragicon

        go.transform.SetParent(_stageNodeRootTrans);
        //go.GetComponent<Button>().onClick.AddListener(() => { });

        Dropable drop = go.AddComponent <Dropable>();

        drop.ActionId = heroData.Id;
        drop.OnDroped = DropOnHero;

        Transform target     = _nodeUIs[targetNodeId];
        UINode    targetNode = target.GetComponent <UINode>();

        go.transform.SetParent(targetNode.GetRef("HeroRoot"));

        _fightHeroNodes.Add(heroData.Id, go.transform);
    }
Ejemplo n.º 13
0
    void SetPathPassed(int fromNodeId, int targetNodeId, Color c)
    {
        DIKey  id   = new DIKey(fromNodeId, targetNodeId);
        UINode node = _nodeLines[id].GetComponent <UINode>();

        node.GetComponent <Slider>().value = 1;
        node.GetRef("Fill").GetComponent <Image>().color = c;
    }
Ejemplo n.º 14
0
    public override void InitUI(UINode rootNode)
    {
        base.InitUI(rootNode);

        _rootNode = rootNode;
        EventSys.Instance.AddHander(ViewEvent.ShowNodeSafeDetails, ShowNodeSafe);
        _rootNode.GetRef("Confirm").GetComponent <Button>().onClick.AddListener(OnConfirmClicked);
        _rootNode.gameObject.SetActive(false);
    }
Ejemplo n.º 15
0
    void ShowWarning(string msg)
    {
        Text t = _warning.GetRef("Text").GetComponent <Text>();

        t.text = msg;
        DelayAction da = _warning.GetComponent <DelayAction>();

        da.StartDelay();
    }
Ejemplo n.º 16
0
    void InitStageUi(UINode rootNode)
    {
        _stageNode   = rootNode.GetNode("Stage");
        _stageCanvas = _stageNode.GetComponent <Canvas>();

        Button btnExit = _stageNode.GetRef("ButtonExit").GetComponent <Button>();

        btnExit.onClick.AddListener(OnBtnExitClicked);

        _modelNode      = _stageNode.GetNode("Models");
        _stageNodeModel = _modelNode.GetNode("Node_model").gameObject;
        _heroNodeModel  = _modelNode.GetNode("HeroNode_model").gameObject;
        _lineModel      = _modelNode.GetNode("Slider_model").gameObject;
        _layerNameModel = _modelNode.GetRef("LayerName_model").gameObject;
        _heroShowModel  = _modelNode.GetNode("HeroShow_model").gameObject;

        _stageScrollContent  = _stageNode.GetNode("Content");
        _stageNodeRootTrans  = _stageScrollContent.GetRef("Stage").transform;
        _stageLineRootTrans  = _stageScrollContent.GetRef("Line").transform;
        _stageLayerRootTrans = _stageScrollContent.GetRef("LayerNames").transform;

        Button btnReady = _stageNode.GetRef("ButtonReady").GetComponent <Button>();

        btnReady.onClick.AddListener(OnBtnReadyClicked);


        _stageNode.GetRef("HeroShowtList").gameObject.SetActive(true);
        _stageNode.GetRef("HeroShowtList").gameObject.SetActive(false);

        _warning = _stageNode.GetNode("Warning");
        DelayAction da = _warning.gameObject.AddComponent <DelayAction>();

        da.DelaySecond = 1;
        da.DAction     = () => { _warning.gameObject.SetActive(false); };
        _warning.gameObject.SetActive(false);

        _dialog = _stageNode.GetNode("Dialog");
        _dialog.GetRef("Button").GetComponent <Button>().onClick.AddListener(() => { EventSys.Instance.AddEvent(InputEvent.FightExit); });
        _dialog.gameObject.SetActive(false);

        _winNode = _stageNode.GetNode("Win");
        _winNode.GetRef("Button").GetComponent <Button>().onClick.AddListener(() => { EventSys.Instance.AddEvent(InputEvent.FightExit); });
        _winNode.gameObject.SetActive(false);
    }
Ejemplo n.º 17
0
    public override void InitUI(UINode rootNode)
    {
        base.InitUI(rootNode);

        _rewardNode = rootNode.GetComponent <UINode>();
        _getBtn     = _rewardNode.GetRef("Get").GetComponent <Button>();
        _getBtn.onClick.AddListener(GetReward);
        _getBtn.gameObject.SetActive(false);

        _exitBtn = _rewardNode.GetRef("Confirm").GetComponent <Button>();
        _exitBtn.onClick.AddListener(HideRewardView);
        _exitBtn.gameObject.SetActive(false);

        _models = rootNode.GetNode("Models");

        _rewardNode.gameObject.SetActive(false);

        EventSys.Instance.AddHander(ViewEvent.ShowNodeRewardDetails, ShowNodeReward);
        EventSys.Instance.AddHander(ViewEvent.ShowNodeRewardGet, GetNodeReward);
    }
Ejemplo n.º 18
0
    void OnUpdateHero(object p1, object p2)
    {
        FightHero fh   = (FightHero)p1;
        UINode    node = _heroNodes[fh.Id].GetComponent <UINode>();

        SetHeroData(fh, node);

        if (node.GetRef("Selected").gameObject.activeSelf)
        {
            RefreshItem(fh);
        }
    }
Ejemplo n.º 19
0
    void OnGetSafeReturnToStage(object p1, object p2)
    {
        FightHero hero = (FightHero)p1;
        //
        Transform nodeTrans = _nodeUIs[hero.LastNodeId];
        ImageGray ig        = nodeTrans.gameObject.AddComponent <ImageGray>();

        ig.Gray = true;
        //
        nodeTrans = _nodeUIs[hero.NowNodeId];
        UINode    node = nodeTrans.GetComponent <UINode>();
        Transform t    = node.GetRef("HeroRoot");

        _fightHeroNodes[hero.Id].transform.SetParent(t);

        SetPathPassed(hero.LastNodeId, hero.NowNodeId, ((HeroData)hero.CreatureData).TheColor);

        if (node.GetRef("HeroRoot").childCount > 1)
        {
            node.GetRef("All").gameObject.SetActive(true);
            Dragable dragable = node.GetRef("All").gameObject.GetComponent <Dragable>();
            if (dragable == null)
            {
                dragable = node.GetRef("All").gameObject.AddComponent <Dragable>();
            }
            dragable.HasTail     = true;
            dragable.TailColor   = Color.white;
            dragable.TailSprite  = GameResSys.Instance.GetMask(GameConstants.CommonDragTail);
            dragable.TailWidth   = 30;
            dragable.ActionId    = hero.NowNodeId;
            dragable.Canv        = _stageCanvas;
            dragable.OnDragStart = i =>
            {
                _dragFrom = DragFrom.All;
                _dragId   = hero.NowNodeId;
            };
        }
    }
Ejemplo n.º 20
0
    void OnEnemyAttack(object p1, object p2)
    {
        FightHero hero   = (FightHero)p1;
        int       damage = (int)p2;

        UINode node = _heroNodes[hero.Id].GetComponent <UINode>();

        SetHeroData(hero, node);
        node.GetRef("Selected").gameObject.SetActive(false);
        ShowHurt(node, damage);

        if (hero.CreatureData.Hp.Value <= 0)
        {
            ImageGray imageGray = node.GetRef("Icon").gameObject.GetComponent <ImageGray>();
            if (imageGray == null)
            {
                imageGray = node.GetRef("Icon").gameObject.AddComponent <ImageGray>();
            }
            imageGray.Gray = true;
        }

        ShowItemDes(string.Empty, null);
    }
Ejemplo n.º 21
0
    /// <summary>
    /// 战斗中,最下方一排的英雄显示赋值
    /// </summary>
    /// <param name="fightHero"></param>
    /// <param name="node"></param>
    void SetShowNodeData(FightHero fightHero, UINode node)
    {
        node.GetRef("Icon").GetComponent <Image>().sprite     = GameResSys.Instance.GetCard(fightHero.CreatureData.Icon);
        node.GetRef("Name").GetComponent <Text>().text        = fightHero.CreatureData.Name;
        node.GetRef("Hp").GetComponent <Text>().text          = "血";
        node.GetRef("HpSlider").GetComponent <Slider>().value = fightHero.CreatureData.HpPercent;
        node.GetRef("Mp").GetComponent <Text>().text          = "气";
        node.GetRef("MpSlider").GetComponent <Slider>().value = fightHero.CreatureData.MpPercent;

        ImageGray ig = node.GetRef("Icon").GetComponent <ImageGray>();

        ig.Gray = fightHero.CreatureData.HpPercent <= 0;
    }
Ejemplo n.º 22
0
    void OnChangeHero(object p1, object p2)
    {
        //reset hero selected label
        FightHero fh = (FightHero)p1;

        foreach (KeyValuePair <int, Transform> pair in _heroNodes)
        {
            Transform t    = pair.Value;
            UINode    node = t.GetComponent <UINode>();
            node.GetRef("Selected").gameObject.SetActive(fh.Id == pair.Key);
        }

        //reset items
        RefreshItem(fh);
    }
Ejemplo n.º 23
0
    void CreateNode(BaseStageNode stageNode, float posX, float posY)
    {
        GameObject go     = Instantiate(_stageNodeModel);
        UINode     uiNode = go.GetComponent <UINode>();

        go.transform.SetParent(_stageNodeRootTrans);
        go.transform.localPosition = new Vector3(posX, posY, 0);

        Button btn = uiNode.GetRef("Button").GetComponent <Button>();

        btn.onClick.AddListener(() => { OnNodeClicked(stageNode.Id); });

        Image nodeImage = uiNode.GetRef("Button").GetComponent <Image>();

        if (stageNode.NodeType.Equals(typeof(StageNodeFight).Name))
        {
            nodeImage.sprite = GameResSys.Instance.GetCard(stageNode.Icon);
        }
        else
        {
            nodeImage.sprite = GameResSys.Instance.GetNodeSprite(stageNode.Icon);
        }

        Dropable drop = uiNode.GetRef("Button").gameObject.AddComponent <Dropable>();

        drop.ActionId = stageNode.Id;
        drop.OnDroped = DropOnNode;
        if (!stageNode.NodeType.Equals(typeof(StageNodeStart).Name))
        {
            drop.enabled = false;
        }

        uiNode.GetRef("All").gameObject.SetActive(false);

        _nodeUIs.Add(stageNode.Id, go.transform);
    }
Ejemplo n.º 24
0
    void OnChangeTurn(object p1, object p2)
    {
        bool isHero = (bool)p1;

        _attBtn.gameObject.SetActive(isHero);
        _skillBtn.gameObject.SetActive(isHero);
        _petBtn.gameObject.SetActive(isHero);
        _itemNodeRoot.gameObject.SetActive(isHero);

        if (!isHero)
        {
            foreach (KeyValuePair <int, Transform> pair in _heroNodes)
            {
                UINode node = pair.Value.GetComponent <UINode>();
                node.GetRef("Selected").gameObject.SetActive(false);
            }
        }
    }
Ejemplo n.º 25
0
    public override void InitUI(UINode rootNode)
    {
        base.InitUI(rootNode);

        _fightNode = rootNode.GetComponent <UINode>();

        Button exitBtn = _fightNode.GetRef("Confirm").GetComponent <Button>();

        exitBtn.onClick.AddListener(() =>
        {
            _fightNode.gameObject.SetActive(false);
            EventSys.Instance.AddEvent(InputEvent.HeroNodeDetailComfirmed, _nodeId);
        });

        _fightNode.gameObject.SetActive(false);

        EventSys.Instance.AddHander(ViewEvent.ShowHeroNodeDetails, ShowNodeFight);
    }
Ejemplo n.º 26
0
    void CreateHeroShowList(Dictionary <int, FightHero> heros)
    {
        _showHeroNodes = new Dictionary <int, Transform>();
        foreach (KeyValuePair <int, FightHero> pair in heros)
        {
            FightHero  fightHero = pair.Value;
            GameObject go        = Instantiate(_heroShowModel);
            UINode     node      = go.GetComponent <UINode>();
            node.GetRef("Icon").gameObject.AddComponent <ImageGray>();
            SetShowNodeData(fightHero, node);

            go.transform.SetParent(_stageNode.GetRef("HeroShowListContent"));

            _showHeroNodes.Add(fightHero.Id, go.transform);
        }

        _stageNode.GetRef("HeroShowtList").gameObject.SetActive(true);
    }
Ejemplo n.º 27
0
    void ShowHurt(UINode node, int damage)
    {
        GameObject hurt = node.GetRef("Hurt").gameObject;

        if (damage < 0)
        {
            hurt.SetActive(false);
            return;
        }
        hurt.GetComponent <Text>().text = "-" + damage;
        DelayAction da = hurt.GetComponent <DelayAction>();

        if (da == null)
        {
            da = hurt.AddComponent <DelayAction>();
        }
        da.DelaySecond = 1;
        da.DAction     = () => { hurt.gameObject.SetActive(false); };
        da.StartDelay();
    }
Ejemplo n.º 28
0
    void ShowMpSupply(UINode node, int sVal)
    {
        GameObject supply = node.GetRef("MpSupply").gameObject;

        if (sVal < 0)
        {
            supply.SetActive(false);
            return;
        }
        supply.GetComponent <Text>().text = "+" + sVal;
        DelayAction da = supply.GetComponent <DelayAction>();

        if (da == null)
        {
            da = supply.AddComponent <DelayAction>();
        }
        da.DelaySecond = 1;
        da.DAction     = () => { supply.gameObject.SetActive(false); };
        da.StartDelay();
    }
Ejemplo n.º 29
0
    void CreateReward(Reward reward)
    {
        UINode    itemNode = _models.GetNode("Item_model");
        Transform scTrans  = _rewardNode.GetRef("Content");

        reward.ConditionData.Sort();
        foreach (Reward.Condition cItem in reward.ConditionData)
        {
            if (!string.IsNullOrEmpty(cItem.Express))
            {
                //show condition
                UINode     conditionNode = _models.GetNode("Condition_model");
                GameObject conditionObj  = Instantiate(conditionNode.gameObject, scTrans);

                UINode cNode = conditionObj.GetComponent <UINode>();
                Dictionary <int, BaseDataInfo> res = ConfigDataMgr.Instance.GetData <PropertyDesTableData>();
                string showExpress = "";
                string showVal     = "";
                foreach (KeyValuePair <int, BaseDataInfo> pair in res)
                {
                    PDesDataInfo info = (PDesDataInfo)pair.Value;
                    if (info.PropertyName.Equals(cItem.Express))
                    {
                        showExpress = info.Description;
                        for (int i = 0; i < info.Values.Count; i++)
                        {
                            if (cItem.Val.Equals(info.Values[i]))
                            {
                                showVal = info.ValueDes[i];
                                break;
                            }
                        }
                    }
                }
                cNode.GetRef("Condition").GetComponent <Text>().text = "如果<color=#4040DC>" + showExpress + "=" + showVal + "</color>";
            }
            foreach (Item item in cItem.Rewards)
            {
                GameObject newNodeObj = Instantiate(itemNode.gameObject, scTrans);
                //newNodeObj.transform.SetParent(scTrans);

                UINode newNode = newNodeObj.GetComponent <UINode>();
                Image  bg      = newNode.GetRef("Bg").GetComponent <Image>();
                bg.sprite = GameResSys.Instance.GetFrame(item.Lv.Value);
                Image icon = newNode.GetRef("Icon").GetComponent <Image>();
                icon.sprite = GameResSys.Instance.GetItem(item.Icon);
                Text itemName = newNode.GetRef("Name").GetComponent <Text>();
                itemName.text = item.Name;
                if (item.Count.Value > 1)
                {
                    itemName.text = item.Name + " * " + item.Count.Value;
                }
                Text itemDes = newNode.GetRef("Des").GetComponent <Text>();
                itemDes.text = item.Description;

                newNodeObj.SetActive(true);
            }
        }
        itemNode.gameObject.SetActive(false);

        _rewardNode.GetRef("Scroll View").GetComponent <ScrollRect>().ScrollToTop();
        _rewardNode.gameObject.SetActive(true);
    }
Ejemplo n.º 30
0
 void OnStageFail(object p1, object p2)
 {
     _dialog.GetRef("Text").GetComponent <Text>().text = "胜败乃兵家常事";
     _dialog.gameObject.SetActive(true);
 }