コード例 #1
0
ファイル: PlayerInfo.cs プロジェクト: AlayaElla/sangharama
    static public void AddGoodsInfo(int goodstype, int id, GoodsInfoType type)
    {
        ArrayList goodlist = new ArrayList();

        if (goodstype == 0)
        {
            goodlist = playerinfo.MaterialInfoList.Items;
            //查找对应的物品信息
            for (int i = 0; i <= goodlist.Count - 1; i++)
            {
                ItemsInfo info = (ItemsInfo)goodlist[i];
                if (info.ID == id)
                {
                    if (type == GoodsInfoType.PutCount)
                    {
                        info.PutCount++;
                        goodlist[i] = info;
                    }
                    else if (type == GoodsInfoType.SellCount)
                    {
                        info.SellCount++;
                        goodlist[i] = info;
                    }
                    else if (type == GoodsInfoType.RecipeCount)
                    {
                        info.RecipeCount++;
                        goodlist[i] = info;
                    }
                    else if (type == GoodsInfoType.CollectCount)
                    {
                        info.CollectCount++;
                        goodlist[i] = info;
                    }
                    playerinfo.MaterialInfoList.Items = goodlist;
                    break;
                }
            }
        }
        else if (goodstype == 1)
        {
            goodlist = playerinfo.MaterialInfoList.Minds;
            //查找对应的物品信息
            for (int i = 0; i <= goodlist.Count - 1; i++)
            {
                MindsInfo info = (MindsInfo)goodlist[i];
                if (info.ID == id)
                {
                    if (type == GoodsInfoType.PutCount)
                    {
                        info.PutCount++;
                        goodlist[i] = info;
                    }
                    else if (type == GoodsInfoType.SellCount)
                    {
                        info.SellCount++;
                        goodlist[i] = info;
                    }
                    else if (type == GoodsInfoType.RecipeCount)
                    {
                        info.RecipeCount++;
                        goodlist[i] = info;
                    }
                    else if (type == GoodsInfoType.CollectCount)
                    {
                        info.CollectCount++;
                        goodlist[i] = info;
                    }
                    playerinfo.MaterialInfoList.Minds = goodlist;
                    break;
                }
            }
        }
        else if (goodstype == 0)
        {
            goodlist = playerinfo.MaterialInfoList.SpecialItems;
            //查找对应的物品信息
            for (int i = 0; i <= goodlist.Count - 1; i++)
            {
                SpecialItemsInfo info = (SpecialItemsInfo)goodlist[i];
                if (info.ID == id)
                {
                    if (type == GoodsInfoType.PutCount)
                    {
                        info.PutCount++;
                        goodlist[i] = info;
                    }
                    else if (type == GoodsInfoType.SellCount)
                    {
                        info.SellCount++;
                        goodlist[i] = info;
                    }
                    else if (type == GoodsInfoType.RecipeCount)
                    {
                        info.RecipeCount++;
                        goodlist[i] = info;
                    }
                    else if (type == GoodsInfoType.CollectCount)
                    {
                        info.CollectCount++;
                        goodlist[i] = info;
                    }
                    playerinfo.MaterialInfoList.SpecialItems = goodlist;
                    break;
                }
            }
        }
        else
        {
            Debug.Log("Unknow goodstype: " + goodstype);
            return;
        }
        PlayerData.PlayerInfoData.Save(playerinfo);
    }
コード例 #2
0
ファイル: PlayerInfo.cs プロジェクト: AlayaElla/sangharama
    void InitPlayerInfoData()
    {
        playerinfo.Languege  = "zh";
        playerinfo.MineCount = 0;
        playerinfo.Money     = 0;

        playerinfo.MapInfoList                   = new ArrayList();
        playerinfo.MaterialInfoList              = new MaterialInfo();
        playerinfo.MaterialInfoList.Items        = new ArrayList();
        playerinfo.MaterialInfoList.Minds        = new ArrayList();
        playerinfo.MaterialInfoList.SpecialItems = new ArrayList();
        playerinfo.MaterialInfoList.Propertys    = new ArrayList();
        playerinfo.SenceInfoList                 = new ArrayList();
        playerinfo.CompleteEvents                = new ArrayList();
        playerinfo.QuestList      = new ArrayList();
        playerinfo.CompleteQuests = new ArrayList();

        //初始材料
        foreach (Materiral.Items m in Materiral.GetItemList())
        {
            ItemsInfo _m = new ItemsInfo();
            _m.ID           = m.ID;
            _m.PutCount     = 0;
            _m.SellCount    = 0;
            _m.RecipeCount  = 0;
            _m.CollectCount = 0;
            playerinfo.MaterialInfoList.Items.Add(_m);
        }
        foreach (Materiral.Minds m in Materiral.GetMindList())
        {
            MindsInfo _m = new MindsInfo();
            _m.ID           = m.ID;
            _m.PutCount     = 0;
            _m.SellCount    = 0;
            _m.RecipeCount  = 0;
            _m.CollectCount = 0;
            playerinfo.MaterialInfoList.Minds.Add(_m);
        }
        foreach (Materiral.SpecialItem m in Materiral.GetSpecialItemList())
        {
            SpecialItemsInfo _m = new SpecialItemsInfo();
            _m.ID           = m.ID;
            _m.PutCount     = 0;
            _m.SellCount    = 0;
            _m.RecipeCount  = 0;
            _m.CollectCount = 0;
            playerinfo.MaterialInfoList.SpecialItems.Add(_m);
        }
        foreach (Materiral.Property m in Materiral.GetPropertyList())
        {
            PropertysInfo _m = new PropertysInfo();
            _m.ID          = m.ID;
            _m.RecipeCount = 0;
            playerinfo.MaterialInfoList.Propertys.Add(_m);
        }

        //初始化场景数据
        for (int i = 0; i <= 1; i++)
        {
            SenceInfo s = new SenceInfo();
            s.ID      = i;
            s.InCount = 0;
            playerinfo.SenceInfoList.Add(s);
        }

        ////初始化地图路点数据
        XmlTool   xt    = new XmlTool();
        ArrayList _list = xt.loadPathXmlToArray();

        MapPathManager.Path[] PathList = new MapPathManager.Path[_list.Count];
        _list.CopyTo(PathList);
        xt = null; _list.Clear();

        foreach (MapPathManager.Path p in PathList)
        {
            MapInfo m = new MapInfo();
            m.ID      = p.Map;
            m.InCount = 0;
            playerinfo.MapInfoList.Add(m);
        }
    }