예제 #1
0
    void ReadXML()
    {
        List <RecItem> itemList = ItemIO.Read(Application.dataPath + "/OUTPUT/itemList_Attribute.xml");

        for (int i = 0; i < itemList.Count; i++)
        {
            RecItem item = itemList[i];
            Debug.Log(string.Format("Item id = [{0}]: ({1},{2},{3})", item.ID, item.Name, item.Level, item.Critical));
        }
    }
예제 #2
0
 public RecItem(RecItem rhs)
 {
     this.m_packId         = rhs.m_packId;
     this.m_index          = rhs.m_index;
     this.m_descStringId   = rhs.m_descStringId;
     this.m_icon           = rhs.m_icon;
     this.m_flags          = rhs.m_flags;
     this.m_buyPrice       = rhs.m_buyPrice;
     this.m_sellPrice      = rhs.m_sellPrice;
     this.m_maxInventory   = rhs.m_maxInventory;
     this.m_inventoryCount = rhs.m_inventoryCount;
 }
예제 #3
0
    // Use this for initialization
    void Start()
    {
        List <RecItem> itemList = new List <RecItem> ();

        for (int i = 0; i < 100; i++)
        {
            RecItem item = new RecItem();

            item.ID       = i;
            item.Name     = "아이템";
            item.Level    = 1;
            item.Critical = Random.Range(0.1f, 1.0f);
            itemList.Add(item);
        }
        ItemIO.Write(itemList, Application.dataPath + "/OUTPUT/itemList_Attribute.xml");

        Debug.Log("Write Test ok");
    }
예제 #4
0
    // Use this for initialization
    void Start()
    {
        List<RecItem> itemList = new List<RecItem> ();

        for (int i = 0; i < 100; i++) {

            RecItem item = new RecItem();

            item.ID = i;
            item.Name = "아이템";
            item.Level = 1;
            item.Critical = Random.Range(0.1f, 1.0f);
            itemList.Add(item);
        }
        ItemIO.Write(itemList,Application.dataPath+"/OUTPUT/itemList_Attribute.xml");

        Debug.Log ("Write Test ok");
    }
예제 #5
0
    public static List<RecItem> Read(string filePath)
    {
        XmlDocument Document = new XmlDocument ();
        Document.Load (filePath);
        XmlElement ItemListElement = Document ["ItemList"];

        List<RecItem> ItemList = new List<RecItem> ();

        foreach (XmlElement itemElement in ItemListElement.ChildNodes) {
            RecItem Item = new RecItem();
            Item.ID = System.Convert.ToInt32(itemElement.GetAttribute("ID"));
            Item.Name = itemElement.GetAttribute("Name");
            Item.Level = System.Convert.ToInt32(itemElement.GetAttribute("Level"));
            //Item.Level = int.Parse(itemElement.GetAttribute("Level");;
            Item.Critical = System.Convert.ToSingle(itemElement.GetAttribute("Critical"));

            ItemList.Add(Item);
        }
        return ItemList;
    }
예제 #6
0
    public static List <RecItem> Read(string filePath)
    {
        XmlDocument Document = new XmlDocument();

        Document.Load(filePath);
        XmlElement ItemListElement = Document ["ItemList"];

        List <RecItem> ItemList = new List <RecItem> ();

        foreach (XmlElement itemElement in ItemListElement.ChildNodes)
        {
            RecItem Item = new RecItem();
            Item.ID    = System.Convert.ToInt32(itemElement.GetAttribute("ID"));
            Item.Name  = itemElement.GetAttribute("Name");
            Item.Level = System.Convert.ToInt32(itemElement.GetAttribute("Level"));
            //Item.Level = int.Parse(itemElement.GetAttribute("Level");;
            Item.Critical = System.Convert.ToSingle(itemElement.GetAttribute("Critical"));

            ItemList.Add(Item);
        }
        return(ItemList);
    }
예제 #7
0
    private DLCPack loadPack(int packId, int sellId)
    {
        AppEngine    canvas       = AppEngine.getCanvas();
        SimWorld     simWorld     = canvas.getSimWorld();
        SimData      simData      = canvas.getSimData();
        TextManager  textManager  = canvas.getTextManager();
        DLCPack      dlcPack      = new DLCPack();
        StringBuffer stringBuffer = new StringBuffer();

        stringBuffer.setLength(0);
        stringBuffer.append(this.m_rootFolder);
        stringBuffer.append(DLCManager.pathSeparatorChar);
        stringBuffer.append(sellId);
        string str1 = stringBuffer.toString();

        stringBuffer.setLength(0);
        stringBuffer.append(str1);
        stringBuffer.append(DLCManager.pathSeparatorChar);
        stringBuffer.append(DLCManager.PACKDATA_FILENAME);
        DataInputStream dis = new DataInputStream(JavaLib.getResourceAsStream(stringBuffer.toString(), false));

        stringBuffer.setLength(0);
        stringBuffer.append(str1);
        stringBuffer.append(DLCManager.pathSeparatorChar);
        stringBuffer.append(DLCManager.STRINGS_DLC_FILENAME);
        string filename      = stringBuffer.toString();
        int    stringPooldId = textManager.addStringsFile(filename);

        dis.readInt();
        dlcPack.d_packId   = dis.readInt();
        dlcPack.d_packName = RecObject.readXMLtoBinString(dis);
        string str2 = this.readXMLtoBinFilename(dis, str1);

        dlcPack.d_objectTextureFilename = str2;
        string str3 = this.readXMLtoBinFilename(dis, str1);

        dlcPack.d_objectScrollingTextureFilename = str3;
        dlcPack.d_objectScrollingTextureTiming   = dis.readInt();
        string str4 = this.readXMLtoBinFilename(dis, str1);

        dlcPack.d_simMaleFilename = str4;
        string str5 = this.readXMLtoBinFilename(dis, str1);

        dlcPack.d_simFemaleFilename = str5;
        string str6 = this.readXMLtoBinFilename(dis, str1);

        dlcPack.d_miniCarModelFilename = str6;
        string str7 = this.readXMLtoBinFilename(dis, str1);

        dlcPack.d_miniCarTextureFilename = str7;
        int length1 = (int)dis.readByte();

        short[] numArray1 = new short[length1];
        for (int index = 0; index < length1; ++index)
        {
            int action = (int)dis.readShort();
            numArray1[index] = (short)action;
            simData.unlockAction(action, packId);
        }
        int length2 = (int)dis.readShort();

        RecObject[] recObjectArray = new RecObject[length2];
        for (int index = 0; index < length2; ++index)
        {
            recObjectArray[index] = new RecObject();
            recObjectArray[index].readDLC(dis, packId, index, stringPooldId, str1);
        }
        int length3 = (int)dis.readByte();

        RecItem[] recItemArray = new RecItem[length3];
        for (int index = 0; index < length3; ++index)
        {
            recItemArray[index] = new RecItem();
            recItemArray[index].readDLC(dis, packId, index, stringPooldId, str1);
        }
        int length4 = (int)dis.readByte();

        short[] numArray2 = new short[length4];
        for (int index = 0; index < length4; ++index)
        {
            int wallId = (int)dis.readShort();
            numArray2[index] = (short)wallId;
            simWorld.unlockWall(wallId, packId);
        }
        int length5 = (int)dis.readByte();

        short[] numArray3 = new short[length5];
        for (int index = 0; index < length5; ++index)
        {
            int floorId = (int)dis.readShort();
            numArray3[index] = (short)floorId;
            simWorld.unlockFloor(floorId, packId);
        }
        int num     = (int)dis.readByte();
        int length6 = 15;

        short[][]    numArray4 = new short[length6][];
        int[][]      numArray5 = new int[length6][];
        string[][][] strArray1 = new string[length6][][];
        for (int index1 = 0; index1 < length6; ++index1)
        {
            int        length7   = (int)dis.readByte();
            short[]    numArray6 = new short[length7];
            int[]      numArray7 = new int[length7];
            string[][] strArray2 = new string[length7][];
            for (int index2 = 0; index2 < length7; ++index2)
            {
                numArray6[index2] = (short)dis.readInt();
                numArray7[index2] = dis.readInt();
                int      length8   = (int)dis.readByte();
                string[] strArray3 = new string[length8];
                for (int index3 = 0; index3 < length8; ++index3)
                {
                    string str8 = this.readXMLtoBinFilename(dis, str1);
                    strArray3[index3] = str8;
                }
                strArray2[index2] = strArray3;
            }
            numArray4[index1] = numArray6;
            numArray5[index1] = numArray7;
            strArray1[index1] = strArray2;
        }
        dlcPack.d_objectRecords             = recObjectArray;
        dlcPack.d_itemRecords               = recItemArray;
        dlcPack.d_simAttribUserIds          = numArray4;
        dlcPack.d_simAttribFlags            = numArray5;
        dlcPack.d_simAttribTextureFilenames = strArray1;
        return(dlcPack);
    }