示例#1
0
    IEnumerator InitPlayerInfo()
    {
        while (GamingData.INSTANCE().HeroState == null)
        {
            yield return(null);
        }
        GamingData.INSTANCE().HeroState.maxHp = GamingData.INSTANCE().HeroState.level * 100;
        GamingData.INSTANCE().HeroState.maxMp = GamingData.INSTANCE().HeroState.level * 100;
        GamingData.INSTANCE().HeroState.levelUpExp = GamingData.INSTANCE().HeroState.level * 100;

        hp_Fill.fillAmount = GamingData.INSTANCE().HeroState.hp / GamingData.INSTANCE().HeroState.maxHp;
        mp_Fill.fillAmount = GamingData.INSTANCE().HeroState.sp / GamingData.INSTANCE().HeroState.maxMp;
        ep_Fill.fillAmount = GamingData.INSTANCE().HeroState.cueeExp / GamingData.INSTANCE().HeroState.levelUpExp;

        hp_Text.text = ((int)((GamingData.INSTANCE().HeroState.hp / GamingData.INSTANCE().HeroState.maxHp) * 100f)).ToString() + "%";
        mp_Text.text = ((int)((GamingData.INSTANCE().HeroState.sp / GamingData.INSTANCE().HeroState.maxMp) * 100f)).ToString() + "%";

        if (GamingData.heroType == 0)
        {
            avatar_Img.sprite = Resources.Load <Sprite>("Item/00");
        }
        else
        {
            avatar_Img.sprite = Resources.Load <Sprite>("Item/01");
        }

        level_Text.text    = GamingData.INSTANCE().HeroState.level.ToString();
        nikeName_Text.text = GamingData.nickname;
    }
示例#2
0
 //根据Dic上交物品
 public void SendItems(Dictionary <string, int> _items)
 {
     foreach (var item in _items.Keys)
     {
         SendMaterial(GamingData.GetItemIDByName(item), _items[item]);
     }
 }
示例#3
0
    public void resetDataForNewRoom()
    {
        roomVO     = new RoomVO();
        playerList = null;
        gamingData = null;

        gameStatus = GameStatus.UNDEFINED;
    }
示例#4
0
 public static GamingData INSTANCE()
 {
     if (instance == null)
     {
         instance = new GamingData();
         return(instance);
     }
     return(instance);
 }
示例#5
0
 //初始化英雄系统
 public override void Init()
 {
     heroInfo  = new HeroInfo(this);
     inventory = new Inventory(this);
     equips    = new Equips(this);
     heroInfo.InitHeroInfo(GamingData.INSTANCE().HeroState);
     inventory.Init(GamingData.INSTANCE().InvenrotyInfo);
     equips.Init(GamingData.INSTANCE().EquipsInfo);
     EventCenter.AddListener(EventDefine.FinishTaskDelete, DeleteItems);
     EventCenter.AddListener(EventDefine.FinishTaskGet, GetItems);
     EventCenter.Broadcast(EventDefine.InitBag, inventory.GetInventoryInfo);
 }
示例#6
0
    /**
     * 重新初始化数据
     */
    public void reinitData()
    {
        roomVO           = new RoomVO();
        myAvatarVO       = null;
        playerList       = null;
        remainRoundCount = 0;
        gameStatus       = GameStatus.UNDEFINED;
        gamingData       = null;

        lotteryDatas   = null;
        isOverByPlayer = false;
    }
示例#7
0
    /**
     * 设置面板的显示内容
     * dispalyFlag:0本回合结算,1全局结算
     */
    public void setDisplaContent(int dispalyFlag, GamingData data)
    {
        _data         = data;
        _hvo          = data.hupaiResponseVO;
        _fvo          = data.finalGameEndVo;
        timeText.text = DateTime.Now.ToString("yyyy-MM-dd");
        roomText.text = "房间号:" + GlobalData.getInstance().roomVO.roomId;

        titleText.text = GameHelper.getHelper().getName();
        roundText.text = "局数:" + (GlobalData.getInstance().roomVO.roundNumber - GlobalData.getInstance().remainRoundCount) + "/" + GlobalData.getInstance().roomVO.roundNumber;
        if (dispalyFlag == 0)
        {
            curContainer.SetActive(true);
            endContainer.SetActive(false);
            continueButton.SetActive(true);
            shareEndButton.SetActive(false);
            closeButton.SetActive(false);
            if (GlobalData.getInstance().remainRoundCount == 0 || GlobalData.isOverByPlayer)
            {
                openFinalButton.GetComponent <Image> ().color = Color.white;
            }
            else
            {
                openFinalButton.GetComponent <Image> ().color = new Color32(200, 200, 200, 128);
            }

            getMas(_hvo.allMas);
            for (int i = 0; i < _hvo.avatarList.Count; i++)
            {
                HupaiResponseItem itemdata = _hvo.avatarList [i];
                itemdata.setMaPoints(allMasList [i]);

                GameObject cell = Instantiate(Resources.Load("Prefab/Panel_GCurCellRenderUI")) as GameObject;
                cell.transform.SetParent(curContainer.transform);
                cell.transform.localScale = Vector3.one;
                cell.GetComponent <GCurCellRenderView> ().setUI(itemdata, _hvo.validMas, _data.BankerUuid);
            }
        }
        else if (dispalyFlag == 1)
        {
            curContainer.SetActive(false);
            endContainer.SetActive(true);
            openFinalButton.SetActive(false);
            continueButton.SetActive(false);
            shareEndButton.SetActive(true);
            closeButton.SetActive(true);
            setFinalScoreContent();
        }
    }
示例#8
0
    //返回背包信息
    public Dictionary <int, GridInfo> GetInventoryData(JsonData _data)
    {
        Dictionary <int, GridInfo> tempInventory = new Dictionary <int, GridInfo>();

        for (int i = 1; i <= 8; i++)
        {
            string tempData = (string)_data["bagItem" + i];
            if (tempData != "-1")
            {
                string[] arrays = tempData.Split('|');
                tempInventory.Add(i, new GridInfo(i, GamingData.GetItemByID(int.Parse(arrays[0])), int.Parse(arrays[1])));
            }

            else
            {
                tempInventory.Add(i, new GridInfo(i, new Item(), 0));
            }
        }
        return(tempInventory);
    }
示例#9
0
 //使用物品
 public void UseItem(int _itemGridID)
 {
     //判断物品是否存在
     if (inventoryInfo[_itemGridID].GetItemID() != -1)
     {
         inventoryInfo[_itemGridID].itemCount--;
         Item item = GamingData.GetItemByID(inventoryInfo[_itemGridID].GetItemID());
         heroSystem.hill(item.UseType, item.Value);
         //如果物品耗尽
         if (inventoryInfo[_itemGridID].itemCount == 0)
         {
             ClearGridInfo(_itemGridID);
             //TODO给UI发送消息
         }
         else
         {
             //TODO提示使用物品并实现效果
         }
     }
     else
     {
         return;
     }
 }
示例#10
0
 Item GetItemFromAll(int _itemID)
 {
     return(GamingData.GetItemByID(_itemID));
 }
示例#11
0
 public GamingDataController(GameSystem _system) : base(_system)
 {
     //实例化数据实体
     data = GamingData.INSTANCE();
 }
示例#12
0
 /// <summary>
 /// 剧情系统的初始化
 /// </summary>
 public override void Init()
 {
     npcSystem.InitNpcSystem(GamingData.synData.npcState);
     taskSystem.InitTaskSystem(GamingData.synData.taskID, GamingData.synData.taskState, GamingData.INSTANCE().InvenrotyInfo);
     ShowMiniTaskPanel();
     //TODO 任务系统初始化
     //拿到当前的任务编号,拿到当前任务,将当前任务的初值赋值进去,根据任务编号初始化npc状态
     //TODO 对话系统初始化
 }
示例#13
0
 //设置英雄信息
 public void SetHeroInfo(GamingData _data)
 {
 }
示例#14
0
    //装备卸下是的回调
    void OnUnEquiped(int _gridID, int _equipID)
    {
        Item item = GamingData.GetItemByID(_equipID);

        heroSystem.SetATK_DEF(item.UseType, -item.Value);
    }