Exemple #1
0
    void ManagerTest()
    {
        var             obj     = Instantiate(_propertyView);
        List <FoodData> jsonObj = FoodData.FromJson(@"[{""class"": 41, ""class_name"": ""jiaozi"", ""left"": 310, ""right"": 474, ""top"": 300, ""bottom"": 148, ""calorie"": 66.14926114040404}]");

        jsonObj = FoodData.CalculateCenterPosition(jsonObj);

        var testFoodData       = jsonObj[0];
        var topLeft            = new Vector3(0, 0, 0.4f);
        var topRight           = new Vector3(0.4f, 0, 0.4f);
        var bottomLeft         = new Vector3(0, 0, 0);
        var bottomRight        = new Vector3(0.4f, 0, 0);
        var center             = new Vector3(0.2f, 0, 0.2f);
        var worldSpaceFoodData = new WorldSpaceFoodData(testFoodData, center, topLeft, topRight, bottomLeft, bottomRight);

        _manager.ReDrawFoodData(new List <WorldSpaceFoodData> {
            worldSpaceFoodData
        });
    }
Exemple #2
0
    void PropertyViewDebugVer2()
    {
        var             obj     = Instantiate(_propertyView);
        List <FoodData> jsonObj = FoodData.FromJson(@"[{""class"": 41, ""class_name"": ""jiaozi"", ""left"": 310, ""right"": 474, ""top"": 300, ""bottom"": 148, ""calorie"": 66.14926114040404}]");

        jsonObj = FoodData.CalculateCenterPosition(jsonObj);

        var testFoodData       = jsonObj[0];
        var topLeft            = new Vector3(0, 0, 0.4f);
        var topRight           = new Vector3(0.4f, 0, 0.4f);
        var bottomLeft         = new Vector3(0, 0, 0);
        var bottomRight        = new Vector3(0.4f, 0, 0);
        var center             = new Vector3(0.2f, 0, 0.2f);
        var worldSpaceFoodData = new WorldSpaceFoodData(testFoodData, center, topLeft, topRight, bottomLeft, bottomRight);

        var foodDataPanel = obj.GetComponent <FoodDataPanel>();

        foodDataPanel.WorldSpaceFoodData = worldSpaceFoodData;
    }