public static void BuildAssetDetailConfig()
        {
            PackerData        packerData   = AssetPackerUtil.GetPackerData();
            AssetDetailConfig detailConfig = AssetPackerUtil.CreateAssetDetailConfig(packerData);

            string assetFilePath = AssetConst.GetAssetDetailConfigPathInEditor();
            string diskFilePath  = PathUtility.GetDiskPath(assetFilePath);

            JSONWriter.WriteToFile <AssetDetailConfig>(detailConfig, diskFilePath);
            AssetDatabase.ImportAsset(assetFilePath);
        }
        public static void BuildAssetBundles(PackerData packerData, BundleBuildData buildData)
        {
            string outputDir = buildData.OutputDir;

            if (string.IsNullOrEmpty(outputDir))
            {
                Debug.LogError("The outputDir is empty");
                return;
            }
            if (Directory.Exists(outputDir) && buildData.CleanupBeforeBuild)
            {
                Directory.Delete(outputDir, true);
            }

            if (!Directory.Exists(outputDir))
            {
                Directory.CreateDirectory(outputDir);
            }

            var manifest = PackAssetBundle(packerData, buildData, outputDir);

            if (manifest == null)
            {
                Debug.LogError("PackAssetBundle Failed");
                return;
            }

            var    assetDetailConfig         = CreateAssetDetailConfig(packerData);
            string assetDetailConfigFilePath = $"{outputDir}/{AssetConst.GetAssetDetailConfigFileName()}";

            JSONWriter.WriteToFile <AssetDetailConfig>(assetDetailConfig, assetDetailConfigFilePath);

            var    bundleDetailConfig         = CreateBundleDetailConfig(manifest);
            string bundleDetailConfigFilePath = $"{outputDir}/{AssetConst.GetBundleDetailConfigFileName()}";

            JSONWriter.WriteToFile <BundleDetailConfig>(bundleDetailConfig, bundleDetailConfigFilePath);
        }
Esempio n. 3
0
        private JArray formatAssetName(JArray queryRes)
        {
            var res =
                queryRes.Select(p =>
            {
                var ins = (JArray)p["vinout"];
                if (ins.Count > 0)
                {
                    var tp = ins.Select(pt =>
                    {
                        pt["assetName"] = AssetConst.getAssetName(pt["asset"].ToString());
                        return(pt);
                    }).GroupBy(pg => pg["address"].ToString(), (kg, gg) => {
                        var address = kg;
                        var arr     =
                            gg.GroupBy(pgg => pgg["asset"].ToString(), (kgg, ggg) =>
                        {
                            var val  = ggg.Sum(p3g => decimal.Parse(p3g["value"].ToString()));
                            var unit = ggg.ToArray()[0]["assetName"].ToString();
                            return(val + " " + unit);
                        }).ToArray();
                        var assetJA = new JArray {
                            arr
                        };
                        var tgRes = new JObject {
                            { "address", address },
                            { "assetJA", assetJA }
                        };
                        return(tgRes);
                    });

                    p["vinout"] = new JArray {
                        tp
                    };
                }
                var outs = (JArray)p["vout"];
                if (outs.Count > 0)
                {
                    var tp = outs.Select(pt =>
                    {
                        pt["assetName"] = AssetConst.getAssetName(pt["asset"].ToString());
                        return(pt);
                    }).GroupBy(pg => pg["address"].ToString(), (kg, gg) => {
                        var address = kg;
                        var arr     =
                            gg.GroupBy(pgg => pgg["asset"].ToString(), (kgg, ggg) =>
                        {
                            var val  = ggg.Sum(p3g => decimal.Parse(p3g["value"].ToString()));
                            var unit = ggg.ToArray()[0]["assetName"].ToString();
                            return(val + " " + unit);
                        }).ToArray();
                        var assetJA = new JArray {
                            arr
                        };
                        var tgRes = new JObject {
                            { "address", address },
                            { "assetJA", assetJA }
                        };
                        return(tgRes);
                    });
                    p["vout"] = new JArray {
                        tp
                    };
                }
                p["net_fee"] += " GAS";
                p["sys_fee"] += " GAS";
                var pj        = (JObject)p;
                pj.Remove("vin");
                return(pj);
            });

            return(new JArray {
                res
            });
        }
    private void InitPointInfo(GameObject pointInfo, FirstLevelMenuConfigInfo imageInfo)
    {
        pointInfo.transform.parent = BG_IMG.transform;

        pointInfo.transform.localScale = Vector3.one;//* 5;
        pointInfo.GetComponent <RectTransform>().anchoredPosition3D = new Vector3(imageInfo.x, -imageInfo.y, 0);
        pointInfo.GetComponent <UnityEngine.UI.Image>().sprite      = Resources.Load <Sprite>(AssetConst.GetSpriteByPointType(imageInfo.point_type));
        pointInfo.GetComponent <UnityEngine.UI.Image>().SetNativeSize();
        for (int i = 0; i < imageInfo.point_info.Count; i++)
        {
            GameObject menuItem = Instantiate(Resources.Load(AssetConst.secondMenu)) as GameObject;
            if (menuItem)
            {
                menuItem.SetActive(false);
                menuItem.transform.parent        = pointInfo.transform;
                menuItem.transform.localPosition = Vector3.one * 0.1f;
                InitMenuItem(menuItem, imageInfo.point_info[i]);
            }
        }
    }
 private void InitMenuItem(GameObject menuItem, SecondLevelMenuConfigInfo itemData)
 {
     Debug.Log("InitMenuItem");
     menuItem.transform.localScale = Vector3.one;
     menuItem.GetComponent <MenuItemScript>().configInfo   = itemData;
     menuItem.GetComponent <UnityEngine.UI.Image>().sprite = Resources.Load <Sprite>(AssetConst.GetSpriteByItemType(itemData.item_type));
     menuItem.GetComponentInChildren <Text>().text         = itemData.text;
     menuItem.GetComponent <Button>().onClick.AddListener(OnItemClick);
 }