Пример #1
0
 public void Show()
 {
     View.transform.DetachChildren();
     RowDate = DynamicDataModel.ReadHeroData();
     ChuanWuDisPlay();
     Debug.Log(JsonMapper.ToJson(RowDate).ToString());
 }
Пример #2
0
    //public static PlayerData StrLevelUp(RowEquipment data)
    //{
    //    PlayerData player = ReadData();
    //    if (data.strLevel >= 10) {
    //        Prefabs.Alert("强化已满!", null);
    //        return player;
    //    }
    //    if (player.gold < data.price) {
    //        Prefabs.Alert("金币不足!", null);
    //        return player;
    //    }
    //    for (int i = 0; i < player.equips.Count; i++)
    //    {
    //        if (player.equips[i].equipmentID == data.equipmentID && player.equips[i].strLevel == data.strLevel)
    //        {
    //            player.equips[i].count -= 1;
    //            player.gold -= 200;

    //            if (player.equips[i].count == 0)
    //            {
    //                player.equips.RemoveAt(i);
    //            }
    //            break;
    //        }
    //    }

    //    bool isAdd = false;

    //    for (int i = 0; i < player.equips.Count; i++)
    //    {
    //        if (player.equips[i].equipmentID == data.equipmentID && player.equips[i].strLevel == data.strLevel + 1)
    //        {
    //            player.equips[i].count += 1;
    //            isAdd = true;
    //            break;
    //        }
    //    }
    //    if (!isAdd)
    //    {
    //        Equip equip = new Equip();
    //        equip.equipmentID = data.equipmentID;
    //        equip.count = 1;
    //        equip.strLevel = data.strLevel + 1;
    //        player.equips.Add(equip);
    //    }

    //    Prefabs.Alert("强化成功,消耗200物资", null);
    //    PlayerPrefs.SetString(key, JsonMapper.ToJson(player));
    //    return player;
    //}

    public static PlayerData StrLevelUp(RowEquipment data)
    {
        PlayerData player = DynamicDataModel.ReadData();

        if (data.strLevel >= 10)
        {
            Prefabs.Alert("强化已满!", null);
            return(player);
        }
        if (player.gold < data.price)
        {
            Prefabs.Alert("金币不足!", null);
            return(player);
        }
        for (int i = 0; i < player.equips.Count; i++)
        {
            if (player.equips[i].equipmentID == data.equipmentID)
            {
                player.gold -= 200;
                player.equips[i].strLevel += 1;
                break;
            }
        }

        Prefabs.Alert("强化成功,消耗200物资", null);
        PlayerPrefs.SetString(key, JsonMapper.ToJson(player));
        return(player);
    }
Пример #3
0
    public void ShowPlayerInfo()
    {
        PlayerData pd = DynamicDataModel.ReadData();

        gold.text    = pd.gold.ToString();
        oil.text     = pd.oil.ToString();
        diamond.text = pd.diamond.ToString();
    }
Пример #4
0
    void Start()
    {
        DynamicDataModel.Init();
        PlayerData data = DynamicDataModel.ReadData();

        oil.text     = data.oil.ToString();
        gold.text    = data.gold.ToString();
        diamond.text = data.diamond.ToString();
        Debug.Log("钻石" + data.diamond);
        //GameObject.Find("Canvas").GetComponent<BootStart>().enabled=false;
    }
Пример #5
0
    public void ShowPackage()
    {
        DynamicDataModel.Init();

        data = DynamicDataModel.ReadData();
        //Debug.Log("玩家数据" + JsonMapper.ToJson(data));
        Num.text  = data.equips.Count + "/" + kucun;
        finalData = StaticDataModel.ReadEquipMerge(data.equips);

        equiplistView.DisPlay_Choice(finalData, this, Choice);
    }
Пример #6
0
    /// <summary>
    /// 装备强化后队伍改变
    /// </summary>
    public static void EquioStrChange()
    {
        List <RowHeroDate> heroList = DynamicDataModel.ReadHeroData();

        for (int i = 0; i < heroList.Count; i++)
        {
            if (CheckIsOnTeamByPID(heroList[i]))
            {
                ChangeHeroSelf(heroList[i]);
            }
        }
    }
Пример #7
0
    public static PlayerData SellPlayerEquip(RowEquipment data)
    {
        PlayerData player = DynamicDataModel.ReadData();

        for (int i = 0; i < player.equips.Count; i++)
        {
            Equip ep = player.equips[i];
            if (ep.equipmentID == data.equipmentID && ep.strLevel == data.strLevel)
            {
                ep.count    -= 1;
                player.gold += data.price;
                if (ep.count == 0)
                {
                    player.equips.RemoveAt(i);
                }
                break;
            }
        }
        Prefabs.Alert("卖出" + data.name + "成功,获得金币" + data.price, null);
        PlayerPrefs.SetString(key, JsonMapper.ToJson(player));
        return(player);
    }
Пример #8
0
 void Awake()
 {
     RowDate = DynamicDataModel.ReadHeroData();
 }
Пример #9
0
 void Awake()
 {
     Clean();
     DynamicDataModel.Init();
 }
 void Start()
 {
     RowDate = DynamicDataModel.ReadHeroData();
     RowDate = StaticDataModel.ReadHeroDateAddEquip(RowDate);
 }
Пример #11
0
    public void WearEquip(RowEquipment date)
    {
        string             json  = PlayerPrefs.GetString("HeroData");
        List <DynamicDate> HeroD = JsonMapper.ToObject <List <DynamicDate> >(json);

        switch (EquipPos)
        {
        case "W":
            for (int i = 0; i < HeroD.Count; i++)
            {
                if (HeroD[i].HeroID == EquipHero.HeroID)
                {
                    HeroD[i].WID = date.equipmentID;
                }
            }
            break;

        case "E1":
            for (int i = 0; i < HeroD.Count; i++)
            {
                if (HeroD[i].HeroID == EquipHero.HeroID)
                {
                    HeroD[i].EID_1 = date.equipmentID;
                }
            }
            break;

        case "E2":
            for (int i = 0; i < HeroD.Count; i++)
            {
                if (HeroD[i].HeroID == EquipHero.HeroID)
                {
                    HeroD[i].EID_2 = date.equipmentID;
                }
            }
            break;
        }
        string newJosn = JsonMapper.ToJson(HeroD);

        PlayerPrefs.SetString("HeroData", newJosn);

        List <RowHeroDate> newList = DynamicDataModel.ReadHeroData();

        for (int i = 0; i < newList.Count; i++)
        {
            if (EquipHero.PackageID == newList[i].PackageID)
            {
                EquipHero = newList[i];
                TeamModel.ChangeHeroSelf(EquipHero);
            }
        }

        GameObject go = Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/PlayerInfo"));

        go.transform.SetParent(GameObject.Find("UI/Canvas").transform);
        (go.transform as RectTransform).localScale    = Vector3.one;
        (go.transform as RectTransform).localPosition = Vector3.zero;
        (go.transform as RectTransform).offsetMax     = Vector2.zero;
        (go.transform as RectTransform).offsetMin     = Vector2.zero;
        go.GetComponent <PlayerInfoView>().Str_DisPlay(EquipHero);

        //GameObject.Find("UI/Canvas/chuanwu").GetComponent<ChuanwuListView>().Show();

        Destroy(gameObject);
    }