示例#1
0
    public void ShowByUID(uint id)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
            return;
        }

        IPlayer player = es.FindPlayer(id);

        if (player == null)
        {
            return;
        }
        int level = player.GetProp((int)CreatureProp.Level);

        #region 基础经验显示
        for (int i = 1; i < 5; i++)
        {
            uint treeID = uint.Parse("50" + i);
            if (treeID == null)
            {
                return;
            }
            table.WishingTreeDataBase data = GameTableManager.Instance.GetTableItem <table.WishingTreeDataBase>(treeID);
            uint       level_min2          = data.level_min2;
            GameObject tree = m_widget_tree.transform.Find("tree_" + i).gameObject;
            UILabel    exp  = tree.transform.Find("exp").GetComponent <UILabel>();
            if (level < level_min2)
            {
                exp.text = (level * data.master_exp_mul1).ToString();
            }
            else
            {
                exp.text = (level * data.master_exp_mul2).ToString();
            }
            Transform status = tree.transform.Find("status").GetComponent <Transform>();
            UISprite  btn    = status.transform.Find("btn_buy_" + i).GetComponent <UISprite>();
            UILabel   price  = btn.GetComponentInChildren <UILabel>();
            price.text = data.price.ToString();
        }

        #region 元宝显示

        #endregion
        #endregion
    }
示例#2
0
    void Buy()
    {
        IPlayer player = ClientGlobal.Instance().MainPlayer;

        if (player != null)
        {
            uint cold = (uint)player.GetProp((int)PlayerProp.Cold);
            table.WishingTreeDataBase data = GameTableManager.Instance.GetTableItem <table.WishingTreeDataBase>(treeData.max_tree);
            uint price = data.price;
            if (cold >= price)
            {
                DataManager.Manager <HomeDataManager>().BuyTree(buyID);
            }
            else
            {
                //充值页面
            }
        }
    }
示例#3
0
    public void Init()
    {
        gameObject.SetActive(true);
        m_nLeftTime = (int)homeDM.TreeLeftTime;
        if (homeDM.MaxTreeID == 501)
        {
            LevelLabel.text = "铁·许愿树";
        }
        if (homeDM.MaxTreeID == 502)
        {
            LevelLabel.text = "铜·许愿树";
        }
        if (homeDM.MaxTreeID == 503)
        {
            LevelLabel.text = "银·许愿树";
        }
        if (homeDM.MaxTreeID == 504)
        {
            LevelLabel.text = "金·许愿树";
        }
        if (m_nLeftTime > 0)
        {
            // TimerAxis.Instance().SetTimer(1000, 1000, this);
        }
        if (m_nLeftTime == 0)
        {
            timeLabel.text = "可收获";
            // TimerAxis.Instance().KillTimer(1000, this);
        }

        table.WishingTreeDataBase data = GameTableManager.Instance.GetTableItem <table.WishingTreeDataBase>(homeDM.MaxTreeID);
        if (data == null)
        {
            return;
        }
        percent.text   = homeDM.HelpNum.ToString() + "/" + data.loveMaxNum.ToString();
        slider.value   = (homeDM.HelpNum + 0.00f) / data.loveMaxNum;
        timeLabel.text = StringUtil.GetStringBySeconds((uint)m_nLeftTime);
    }
示例#4
0
 /// <summary>
 /// 点击实体  传人物ID进去
 /// </summary>
 /// <param name="selfId"></param>
 public void ClickTree(uint selfId)
 {
     //获取进入的是谁的家园这个目前还没有 以后换成进入家园的角色ID就行了   根据这个角色Id获取他的许愿树等级
     if (DataManager.Manager <RelationManager>().IsMyFriend(selfId) || selfId == ClientGlobal.Instance().MainPlayer.GetID())
     {
         //树不在集赞状态  可以收获
         stReqTreeDataHomeUserCmd_C cmd = new stReqTreeDataHomeUserCmd_C();
         NetService.Instance.Send(cmd);
         table.WishingTreeDataBase data = GameTableManager.Instance.GetTableItem <table.WishingTreeDataBase>(MaxTreeID);
         uint max_help_num = data.loveMaxNum;
         if (HelpNum < max_help_num)
         {
             //园主自己的点赞
             if (selfId == ClientGlobal.Instance().MainPlayer.GetID())
             {
                 if (HelpSelf)
                 {
                     if (TreeLeftTime > 0 && TreeIDs.Count < 4)
                     {
                         DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.WishTreePanel);
                     }
                 }
                 else
                 {
                     stHelpTreeHomeUserCmd_CS c = new stHelpTreeHomeUserCmd_CS()
                     {
                         help_who = selfId
                     };
                     NetService.Instance.Send(c);
                 }
             }
             //好友的点赞
             else
             {
                 stHelpTreeHomeUserCmd_CS c = new stHelpTreeHomeUserCmd_CS()
                 {
                     help_who = selfId
                 };
                 NetService.Instance.Send(c);
             }
         }
         else
         {
             if (TreeIDs.Count < 4)
             {
                 DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.WishTreePanel);
             }
             else
             {
                 TipsManager.Instance.ShowTipsById(114122);
             }
         }
     }
     else
     {
         //显示添加好友的TipsManager
         Action AddFriend = delegate
         {
             DataManager.Instance.Sender.RequestAddRelation(GameCmd.RelationType.Relation_Friend, selfId);
         };
         TipsManager.Instance.ShowTipWindow(TipWindowType.YesNO, "您和他不是好友,是否添加好友?", AddFriend, null, null, "提示", "确定", "取消");
     }
 }