Beispiel #1
0
    //PlayerPrefs에 저장
    private void SaveItemData()
    {
        try
        {
            if (Application.platform == RuntimePlatform.Android)
            {
                f = File.OpenWrite(Application.persistentDataPath + "/FurnitureDatacsv.csv");
            }
            else if (Application.platform == RuntimePlatform.WindowsEditor)
            {
                f = File.OpenWrite(strPath + "FurnitureDatacsv.csv");
            }

            StreamWriter writer = new StreamWriter(f, System.Text.Encoding.Unicode);

            var e = ItemData.GetEnumerator();

            while (e.MoveNext())
            {
                FurnitureInfo info  = e.Current.Value;
                string        value = info.ToString();
                writer.WriteLine(value);
            }

            writer.Close();
        }
        catch (NullReferenceException e)
        {
        }
    }
        public async Task <IActionResult> Edit(int id, [Bind("FurnitureInfoID,FurnitureName,OfferPrice,Price,Extension,FurnitureSubCategoryID,BrandID")] FurnitureInfo furnitureInfo)
        {
            if (id != furnitureInfo.FurnitureInfoID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(furnitureInfo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FurnitureInfoExists(furnitureInfo.FurnitureInfoID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BrandID"] = new SelectList(_context.Brands, "BrandID", "BrandName", furnitureInfo.BrandID);
            ViewData["FurnitureSubCategoryID"] = new SelectList(_context.FurnitureSubCategories, "FurnitureSubCategoryID", "FurnitureSubCategoryName", furnitureInfo.FurnitureSubCategoryID);
            return(View(furnitureInfo));
        }
Beispiel #3
0
    void Start()
    {
        LoadEnvironmentModels();

        int i = 0;

        foreach (var item in furnitureList)
        {
            FurnitureInfo info = item.Value;
            // Create directory for the furniture
            furnitureName = item.Key;
            furnitureName = "0189_TABLE_BILLSTA ROUND";
            rootFolder    = Directory.GetCurrentDirectory() + "/MujocoOutput/";
            folder        = rootFolder + furnitureName + "/";
            //GenerateSTL();
            CreateXML();
            i += 1;
            if (i == 1)
            {
                break;
            }
        }

        //EditorApplication.isPlaying = false;
    }
 /// <summary>
 /// Activate the furnitrue.
 /// Sets the furniture info window.
 /// </summary>
 public void Activate(FurnitureType type, FurnitureInfo info)
 {
     if (FurnitureTriggerInfo.Type == FurnitureType.None)
     {
         isTriggerd = true;
         FurnitureTriggerInfo.SetActiveFurniture(type, info);
     }
 }
Beispiel #5
0
 public void SetItem(int id, FurnitureInfo d)
 {
     if (ItemData.ContainsKey(id))
     {
         ItemData[id] = d;
         SaveItemData();
     }
 }
Beispiel #6
0
    public static void Write(FurnitureInfo furnitureInfo, string fileName, string folderName = "/Models/")
    {
        List <PartInfo> partList         = furnitureInfo.partList;
        string          filePath         = Application.dataPath + folderName + fileName + ".xml";
        XmlDocument     Document         = new XmlDocument();
        XmlElement      furnitureElement = Document.CreateElement("FurnitureInfo");

        furnitureElement.SetAttribute("version", "1");
        furnitureElement.SetAttribute("path", furnitureInfo.path);
        furnitureElement.SetAttribute("name", fileName);
        Document.AppendChild(furnitureElement);

        // Write unit info
        XmlElement partListElement = Document.CreateElement("UnitList");

        furnitureElement.AppendChild(partListElement);
        foreach (PartInfo unit in partList)
        {
            XmlElement unitElement = Document.CreateElement("Unit");
            unitElement.SetAttribute("name", unit.name);
            unitElement.SetAttribute("path", unit.path);
            unitElement.SetAttribute("shape", unit.shapeDesc);
            WriteVector3(unitElement, "s", unit.scale);
            WriteVector3(unitElement, "r", unit.rotation);
            WriteVector3(unitElement, "p", unit.position);

            foreach (JointInfo joint in unit.joints)
            {
                XmlElement jointElement = Document.CreateElement("Joint");
                jointElement.SetAttribute("group", joint.group);
                jointElement.SetAttribute("opponent", joint.opponent);
                jointElement.SetAttribute("path", joint.path);
                WriteVector3(jointElement, "s", joint.scale);
                WriteVector3(jointElement, "r", joint.rotation);
                WriteVector3(jointElement, "p", joint.position);
                jointElement.SetAttribute("type", joint.type);
                unitElement.AppendChild(jointElement);
            }
            partListElement.AppendChild(unitElement);
        }

        // Write manual info
        XmlElement manualListElement = Document.CreateElement("ManualList");

        furnitureElement.AppendChild(manualListElement);
        foreach (ManualInfo manual in furnitureInfo.manualList)
        {
            XmlElement manualElement = Document.CreateElement("Manual");
            manualElement.SetAttribute("m1", manual.m1.ToString());
            manualElement.SetAttribute("m2", manual.m2.ToString());
            manualElement.SetAttribute("group1", manual.group1);
            manualElement.SetAttribute("group2", manual.group2);
            manualListElement.AppendChild(manualElement);
        }

        Document.Save(filePath);
    }
Beispiel #7
0
    public void SetActiveFurnitureSetsCorrectFurnitureType_Test(FurnitureType expected)
    {
        // setup
        FurnitureInfo info = new FurnitureInfo(expected.ToString(), expected.ToString(), new KeyCode[] { });

        // perform
        FurnitureTriggerInfo.SetActiveFurniture(expected, info);

        // assert
        Assert.AreEqual(expected, FurnitureTriggerInfo.Type);
    }
Beispiel #8
0
    public void SetActiveFurnitureThrowsWarningMessageWhenFurnitureInfoHasMoreThanTwoKeyCodes_Test()
    {
        // setup
        FurnitureInfo info = new FurnitureInfo("example", "example", new KeyCode[] { KeyCode.A, KeyCode.B, KeyCode.C });

        // perform
        FurnitureTriggerInfo.SetActiveFurniture(FurnitureType.CArm, info);

        // assert
        LogAssert.Expect(LogType.Warning, "The GUI can only handle two different keys!");
    }
Beispiel #9
0
 public void ChangeItemData(FurnitureInfo info)
 {
     if (this.info == info)
     {
         return;
     }
     else if (this.info != info)
     {
         ItemName.text        = info.ItemName;
         ItemDescription.text = info.Description;
     }
 }
Beispiel #10
0
    public void SetActiveFurnitureActivatesFurnitureInfoUI_Test()
    {
        // setup
        FurnitureInfo info = new FurnitureInfo("example", "example", new KeyCode[] { });

        // perform
        FurnitureTriggerInfo.SetActiveFurniture(FurnitureType.CArm, info);

        // get
        bool active = GameObject.Find("GUI/FurnitureInfo").activeSelf;

        // assert
        Assert.IsTrue(active);
    }
Beispiel #11
0
    private void GenerateSTL()
    {
        FurnitureInfo furnitureInfo = furnitureList[furnitureName];
        GameObject    original      = Resources.Load <GameObject>(furnitureInfo.path);

        if (original == null)
        {
            print(furnitureInfo + " does not have prefab, skipping STL conversion");
            return;
        }
        if (!Directory.Exists(folder))
        {
            Directory.CreateDirectory(folder);
        }
        GameObject clone = Instantiate(original, new Vector3(100f, 0f, 0f), new Quaternion(1f, 0f, 0f, 0f));
        // get top level children (parts)
        List <GameObject> children = new List <GameObject>();

        foreach (Transform child in clone.transform)
        {
            GameObject c = child.gameObject;
            if (c.name.Contains("part"))
            {
                children.Add(c);
            }
        }
        // create stl files for each part
        foreach (GameObject child in children)
        {
            MeshFilter[]      mfs         = child.GetComponentsInChildren <MeshFilter>();
            List <GameObject> partObjects = new List <GameObject>();
            foreach (MeshFilter m in mfs)
            {
                if (!m.name.Contains("joint"))
                {
                    partObjects.Add(m.gameObject);
                }
            }
            // create unified STL file for all meshes in the part
            GameObject[] partChildren = partObjects.ToArray();
            string       path         = folder + child.name + ".stl";
            if (partChildren.Length > 0)
            {
                Exporter.Export(path, partChildren, FileType.Binary);
            }
        }
        print(furnitureName + " generated STL.");
        //DestroyImmediate(clone);
    }
Beispiel #12
0
    public void SetActiveFurnitureLoadsCorrectFurnitureNameIntoUI_Test(FurnitureType type)
    {
        // setup
        string        expected = type.ToString();
        FurnitureInfo info     = new FurnitureInfo(expected, expected, new KeyCode[] { });

        // perform
        FurnitureTriggerInfo.SetActiveFurniture(type, info);

        // get
        string actual = GameObject.Find("GUI/FurnitureInfo/Name").GetComponent <TextMeshProUGUI>().text;

        // assert
        Assert.AreEqual(expected, actual);
    }
Beispiel #13
0
    private void SwitchToShopPhase()
    {
        string validSceneName = "Shop Phase Scene";

        while (SceneManager.GetSceneByName(validSceneName).IsValid())
        {
            validSceneName = validSceneName + "1";
        }

        Scene newScene     = SceneManager.CreateScene(validSceneName);
        Scene currentScene = SceneManager.GetActiveScene();

        SceneManager.UnloadScene(currentScene);
        SceneManager.SetActiveScene(newScene);

        GameObject roomObj = GameObject.Instantiate(MetaInformation.Instance().roomPrefab) as GameObject;
        Shop       newShop = roomObj.GetComponent <Shop> ();

        shop = newShop;


        shopGrid = new ShopGrid(shopGridSizeX, shopGridSizeY, 0, 4);


        FurnitureInfo[] oldFurniture = new FurnitureInfo[furnitureInShop.Count];
        furnitureInShop.CopyTo(oldFurniture);
        furnitureInShop.Clear();

        foreach (FurnitureInfo f in oldFurniture)
        {
            var newFurnitureObj = Furniture.InstantiateFurnitureByID(f.furnitureID);
            var newFurniture    = newFurnitureObj.GetComponent <Furniture> ();

            if (!newFurniture.PlaceAtLocation(newShop, f.position))
            {
                Debug.Log("A furniture was in an invalid position in the savefile!");
                GameObject.Destroy(newFurnitureObj);
            }
        }

        GameObject.Instantiate(MetaInformation.Instance().shopPhaseDayCanvasPrefab);
        GameObject.Instantiate(MetaInformation.Instance().playerPrefab);

        foreach (GameObject prefab in generalObjectPrefabs)
        {
            GameObject.Instantiate(prefab);
        }
    }
Beispiel #14
0
    public void SetActiveFurnitureLoadsCorrectKeyCodesIntoUIForTwoKeys_Test(FurnitureType type, KeyCode[] keys)
    {
        // setup
        string        expected = type.ToString();
        FurnitureInfo info     = new FurnitureInfo(expected, expected, keys);

        // perform
        FurnitureTriggerInfo.SetActiveFurniture(type, info);

        // get
        string actual0 = GameObject.Find("GUI/FurnitureInfo/Keys/1/KeyName").GetComponent <TextMeshProUGUI>().text;
        string actual1 = GameObject.Find("GUI/FurnitureInfo/Keys/2/KeyName").GetComponent <TextMeshProUGUI>().text;

        // assert
        Assert.AreEqual(keys[0].ToString(), actual0);
        Assert.AreEqual(keys[1].ToString(), actual1);
    }
Beispiel #15
0
    public void SetActiveFurnitureLoadsCorrectKeyCodesIntoUIForZeroKeys_Test(FurnitureType type)
    {
        // setup
        string        expected = "";
        string        name     = type.ToString();
        FurnitureInfo info     = new FurnitureInfo(name, name, new KeyCode[] {  });

        // perform
        FurnitureTriggerInfo.SetActiveFurniture(FurnitureType.CArm, info);

        // get
        string actual0 = GameObject.Find("GUI/FurnitureInfo/Keys/1/KeyName").GetComponent <TextMeshProUGUI>().text;
        string actual1 = GameObject.Find("GUI/FurnitureInfo/Keys/2/KeyName").GetComponent <TextMeshProUGUI>().text;

        // assert
        Assert.AreEqual(expected, actual0);
        Assert.AreEqual(expected, actual1);
    }
Beispiel #16
0
    /// <summary>
    /// Sets the content of the info window to the correct infos of the FurnitureInfo object.
    /// Hides the windwo if the current funiture type is NONE.
    /// </summary>
    private static void SetUI(FurnitureInfo info)
    {
        GameObject infoGameObject = GameObject.Find("GUI").transform.Find("FurnitureInfo").gameObject;

        if (Type != FurnitureType.None)
        {
            infoGameObject.SetActive(true);

            TextMeshProUGUI name        = infoGameObject.transform.Find("Name").gameObject.GetComponent <TextMeshProUGUI>();
            TextMeshProUGUI description = infoGameObject.transform.Find("Description").gameObject.GetComponent <TextMeshProUGUI>();

            name.text        = info.Name;
            description.text = info.Description;

            SetKeys(info.KeyCodes);
        }
        else
        {
            infoGameObject.SetActive(false);
        }
    }
        public async Task <IActionResult> Create([Bind("FurnitureInfoID,FurnitureName,OfferPrice,Price,File,FurnitureSubCategoryID,BrandID")] FurnitureInfo furnitureInfo)
        {
            using (var memoryStream = new MemoryStream())
            {
                await furnitureInfo.File.FormFile.CopyToAsync(memoryStream);

                string photoname = furnitureInfo.File.FormFile.FileName;
                furnitureInfo.Extension = Path.GetExtension(photoname);
                if (!".jpg.jpeg.png.gif.bmp".Contains(furnitureInfo.Extension.ToLower()))
                {
                    ModelState.AddModelError("File.FormFile", "Only Images Allowed");
                }
                else
                {
                    ModelState.Remove("Extension");
                }
            }
            if (ModelState.IsValid)
            {
                _context.Add(furnitureInfo);
                await _context.SaveChangesAsync();

                var uploadsRootFolder = Path.Combine(_environment.WebRootPath, "furnitures");
                if (!Directory.Exists(uploadsRootFolder))
                {
                    Directory.CreateDirectory(uploadsRootFolder);
                }
                string filename = furnitureInfo.FurnitureInfoID + furnitureInfo.Extension;
                var    filePath = Path.Combine(uploadsRootFolder, filename);
                using (var fileStream = new FileStream(filePath, FileMode.Create))
                {
                    await furnitureInfo.File.FormFile.CopyToAsync(fileStream).ConfigureAwait(false);
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BrandID"] = new SelectList(_context.Brands, "BrandID", "BrandName", furnitureInfo.BrandID);
            ViewData["FurnitureSubCategoryID"] = new SelectList(_context.FurnitureSubCategories, "FurnitureSubCategoryID", "FurnitureSubCategoryName", furnitureInfo.FurnitureSubCategoryID);
            return(View(furnitureInfo));
        }
Beispiel #18
0
    public static FurnitureInfo Read(string fileName, string folderName = "/Models/")
    {
        FurnitureInfo     furnitureInfo = new FurnitureInfo();
        List <PartInfo>   unitList      = new List <PartInfo>();
        List <ManualInfo> manualList    = new List <ManualInfo>();

        string      filePath = Application.dataPath + folderName + fileName + ".xml";
        XmlDocument document = new XmlDocument();

        document.Load(filePath);
        XmlElement furnitureElement = document["FurnitureInfo"];

        furnitureInfo.version = furnitureElement.GetAttribute("version");
        furnitureInfo.path    = furnitureElement.GetAttribute("path");
        furnitureInfo.name    = furnitureElement.GetAttribute("name");
        string scale = furnitureElement.GetAttribute("scale");

        furnitureInfo.scale = scale.Equals("") ? 1f : System.Convert.ToSingle(scale);

        XmlNode unitListElement = furnitureElement.ChildNodes[0];

        furnitureInfo.numPart = 0;
        foreach (XmlElement unitElement in unitListElement.ChildNodes)
        {
            PartInfo unit = new PartInfo();
            unit.name      = unitElement.GetAttribute("name");
            unit.path      = unitElement.GetAttribute("path");
            unit.shapeDesc = unitElement.GetAttribute("shape");
            unit.scale     = ReadVector3(unitElement, "s");
            unit.scale    *= furnitureInfo.scale;
            // TODO: rotation and position are used for checking correct assembly result.
            unit.rotation  = ReadVector3(unitElement, "r");
            unit.position  = ReadVector3(unitElement, "p");
            unit.position *= furnitureInfo.scale;

            unit.joints = new List <JointInfo>();
            foreach (XmlElement jointElement in unitElement.ChildNodes)
            {
                JointInfo joint = new JointInfo();
                joint.group    = jointElement.GetAttribute("group");
                joint.opponent = jointElement.GetAttribute("opponent");
                joint.path     = jointElement.GetAttribute("path");
                joint.scale    = ReadVector3(jointElement, "s");
                if (furnitureInfo.version != "1")
                {
                    joint.scale.x = joint.scale.x * 3f;
                    joint.scale.z = joint.scale.z * 3f;
                }
                joint.rotation = ReadVector3(jointElement, "r");
                joint.position = ReadVector3(jointElement, "p");
                joint.type     = jointElement.GetAttribute("type");
                unit.joints.Add(joint);
            }
            unitList.Add(unit);
            furnitureInfo.numPart++;
        }
        furnitureInfo.partList = unitList;

        // Write manual info
        XmlNode manualListElement = furnitureElement.ChildNodes[1];

        foreach (XmlElement manualElement in manualListElement.ChildNodes)
        {
            ManualInfo manual = new ManualInfo {
                m1     = System.Convert.ToInt32(manualElement.GetAttribute("m1")),
                m2     = System.Convert.ToInt32(manualElement.GetAttribute("m2")),
                group1 = manualElement.GetAttribute("group1"),
                group2 = manualElement.GetAttribute("group2")
            };
            string scale1 = manualElement.GetAttribute("scale1");
            string scale2 = manualElement.GetAttribute("scale2");
            manual.scale1 = scale1.Equals("") ? 1f : System.Convert.ToSingle(scale1);
            manual.scale2 = scale2.Equals("") ? 1f : System.Convert.ToSingle(scale2);
            manualList.Add(manual);
        }
        furnitureInfo.manualList = manualList;

        return(furnitureInfo);
    }
Beispiel #19
0
    /// <summary>
    /// Activates the furniture info window.
    /// Sets the ifno content to the content of the given info object.
    /// </summary>
    public static void SetActiveFurniture(FurnitureType type, FurnitureInfo info)
    {
        Type = type;

        SetUI(info);
    }
Beispiel #20
0
    private void CreateXML()
    {
        FurnitureInfo furnitureInfo = furnitureList[furnitureName];
        GameObject    original      = Resources.Load <GameObject>(furnitureInfo.path);

        if (original == null)
        {
            print(furnitureInfo + " does not have prefab, skipping XML generation");
            return;
        }
        GameObject clone = Instantiate(original, new Vector3(100f, 0f, 0f), new Quaternion(1f, 0f, 0f, 0f));
        // get top level children (parts)
        List <GameObject> children = new List <GameObject>();

        foreach (Transform child in clone.transform)
        {
            GameObject c = child.gameObject;
            if (c.name.Contains("part"))
            {
                children.Add(c);
            }
        }

        // now STL files are created, generate Mujoco XML
        XmlDocument Document      = new XmlDocument();
        XmlElement  mujocoElement = Document.CreateElement("mujoco");

        mujocoElement.SetAttribute("model", furnitureName);


        XmlElement assetElement     = Document.CreateElement("asset");
        XmlElement equalityElement  = Document.CreateElement("equality");
        XmlElement worldbodyElement = Document.CreateElement("worldbody");

        // Generate assets tag, with mesh as children
        string[] meshPaths = Directory.GetFiles(folder, "*.stl");
        foreach (GameObject child in children)   // for each part
        {
            string     partName = child.name;
            string     meshPath = furnitureName + "/" + partName + ".stl";
            XmlElement mesh     = Document.CreateElement("mesh");
            mesh.SetAttribute("name", partName);
            mesh.SetAttribute("file", meshPath);
            Vector3 scale    = GameObject.Find(partName).transform.localScale;
            Vector3 mujScale = new Vector3(scale[0], scale[2], scale[1]);
            mesh.SetAttribute("scale", Vector3String(scale));
            assetElement.AppendChild(mesh);
        }

        XmlElement texture = Document.CreateElement("texture");

        texture.SetAttribute("file", "textures/light-wood.png");
        texture.SetAttribute("name", "tex-light-wood");
        texture.SetAttribute("type", "2d");

        XmlElement material = Document.CreateElement("material");

        material.SetAttribute("name", "light-wood");
        material.SetAttribute("reflectance", "0.5");
        material.SetAttribute("texrepeat", "20 20");
        material.SetAttribute("texture", "tex-light-wood");
        material.SetAttribute("texuniform", "true");

        assetElement.AppendChild(texture);
        assetElement.AppendChild(material);

        // Generate Equality tags


        // Worldbody tags


        foreach (GameObject c in children)
        {
            XmlElement body = Document.CreateElement("body");
            // set name, pos, quat of body
            body.SetAttribute("name", c.name);
            //Use opposite of setTransform to get mujoco pos, rot
            Vector3 scale = c.transform.localScale;
            Vector3 pos   = c.transform.localPosition;
            pos.x *= scale.x;
            pos.y *= scale.y;
            pos.z *= scale.z;

            Vector3 mujPos = new Vector3(pos[0], -pos[2], pos[1]);
            body.SetAttribute("quat", "0 0.707 -0.707 0");
            body.SetAttribute("pos", Vector3String(mujPos));

            // Create geom, sites for body tag
            XmlElement geom = Document.CreateElement("geom");
            geom.SetAttribute("mass", "5");
            geom.SetAttribute("material", "light-wood");
            geom.SetAttribute("mesh", c.name);
            geom.SetAttribute("name", c.name);
            geom.SetAttribute("rgba", "0.82 0.71 0.55 1");
            geom.SetAttribute("type", "mesh");
            geom.SetAttribute("density", "100");
            geom.SetAttribute("solref", "0.001 1");

            // generate joint sites
            print("getting joints for " + c.name);

            foreach (Transform child in c.transform)
            {
                if (child.name.Contains("joint"))
                {
                    print(child.name);
                }
            }


            body.AppendChild(geom);
            worldbodyElement.AppendChild(body);
        }

        string filePath = rootFolder + furnitureName + ".xml";

        mujocoElement.AppendChild(assetElement);
        mujocoElement.AppendChild(equalityElement);
        mujocoElement.AppendChild(worldbodyElement);
        Document.AppendChild(mujocoElement);
        Document.Save(filePath);
        print(filePath);
        DestroyImmediate(clone);
    }
 public DataService RegisterFurniture(FurnitureInfo furnitureInfo)
 {
     FurnitureData.Add(furnitureInfo);
     return(this);
 }
Beispiel #22
0
    //인벤토리에 아이템을 추가하고 데이터에 추가
    public FurnitureInfo ItemGenerate(int Code, bool HaveItem, int MaxDur, int CurDur, string Name, bool Use, bool Rotate, string Description)
    {
        FurnitureInfo info = new FurnitureInfo(Code, HaveItem, MaxDur, CurDur, Name, Use, Rotate, Description);

        return(info);
    }
Beispiel #23
0
 public QuestFurnitureReward(int rpFurnitureID, int rpCount) : base(rpCount)
 {
     Furniture = KanColleGame.Current.MasterInfo.Furnitures[rpFurnitureID];
     Quantity  = rpCount;
 }
Beispiel #24
0
    public void EmptyConstructorName_Test()
    {
        FurnitureInfo info = new FurnitureInfo();

        Assert.IsNotNull(info.Name);
    }
Beispiel #25
0
    public void ConstructorKeyCodes_Test(string name, string description, KeyCode[] expected)
    {
        FurnitureInfo info = new FurnitureInfo(name, description, expected);

        Assert.AreEqual(expected, info.KeyCodes);
    }
Beispiel #26
0
    public void ConstructorDescription_Test(string name, string expected, KeyCode[] keys)
    {
        FurnitureInfo info = new FurnitureInfo(name, expected, keys);

        Assert.AreEqual(expected, info.Description);
    }
Beispiel #27
0
    public void ConstructorName_Test(string expected, string description, KeyCode[] keys)
    {
        FurnitureInfo info = new FurnitureInfo(expected, description, keys);

        Assert.AreEqual(expected, info.Name);
    }
Beispiel #28
0
    public void EmptyConstructorKeyCodes_Test()
    {
        FurnitureInfo info = new FurnitureInfo();

        Assert.IsNotNull(info.KeyCodes);
    }
Beispiel #29
0
    public void EmptyConstructorDescription_Test()
    {
        FurnitureInfo info = new FurnitureInfo();

        Assert.IsNotNull(info.Description);
    }
    private void GetDataParse()
    {
        foreach (TileData _data in mapDataArr)
        {
            if (_data != null)
            {
                TileInfo _info = new TileInfo();

                string[] xyPos = _data.pos.Split('/');
                int      x     = int.Parse(xyPos[0]);
                int      y     = int.Parse(xyPos[1]);

                _info.position  = new Vector2(x, y);
                _info.roomIndex = _data.roomIndex;
                _info.roomType  = _data.roomType;
                _info.doorArr   = _data.doorArr;

                foreach (KeyValuePair <string, int> _dicionary in _data.monSpawnInfoDic)
                {
                    string[] _xyPos = _dicionary.Key.Split('/');

                    float _x = float.Parse(_xyPos[0]);
                    float _y = float.Parse(_xyPos[1]);

                    int _type = _dicionary.Value;

                    _info.monSpawnInfoDic.Add(new Vector2(_x, _y), _type);
                }

                foreach (KeyValuePair <string, FurnitureData> _dicionary in _data.FurnitureInfoDic)
                {
                    FurnitureInfo _finfo = new FurnitureInfo();

                    string[] _xyPos = _dicionary.Key.Split('/');

                    float _x = float.Parse(_xyPos[0]);
                    float _y = float.Parse(_xyPos[1]);

                    FurnitureData _fdata = _dicionary.Value;

                    _finfo.name = _fdata.name;
                    _finfo.pos  = new Vector2(_x, _y);
                    _finfo.dir  = _fdata.dir;

                    _info.FurnitureInfoDic.Add(_finfo.pos, _finfo);
                }

                if (roomIndexListArr[_info.roomIndex] == null)
                {
                    List <TileInfo> roomIndexList = new List <TileInfo>();

                    roomIndexListArr[_info.roomIndex] = roomIndexList;
                }

                roomIndexListArr[_info.roomIndex].Add(_info);

                boardRoomIndexArr[BoardPosParse(x), BoardPosParse(y)] = _info.roomIndex;

                CreateMiniMap(_info);
            }
        }

        mapDataArr = null;
    }