コード例 #1
0
        public void SetContent(IResourceRef res, ResourceGroupItem rg)
        {
            resourceGroup = rg;
            resource      = res;
            Name.text     = res.Resources.Name;
            foreach (var kp in res.Resources.Attrs)
            {
                GameObject obKey = new GameObject(kp.Key + ":key");
                var        txKey = obKey.AddComponent <Text>();
                txKey.font      = Font.CreateDynamicFontFromOSFont("Arial", 12);
                txKey.alignment = TextAnchor.MiddleLeft;
                txKey.text      = kp.Key;
                txKey.color     = Color.black;

                GameObject obValue = new GameObject(kp.Value + ":value");
                var        txValue = obValue.AddComponent <Text>();
                txValue.font      = Font.CreateDynamicFontFromOSFont("Arial", 12);
                txValue.alignment = TextAnchor.MiddleLeft;
                txValue.text      = kp.Value;
                txValue.color     = Color.black;

                txKey.transform.parent   = AttrContainor;
                txValue.transform.parent = AttrContainor;
            }

            grid.CalculateLayoutInputHorizontal();
            grid.CalculateLayoutInputHorizontal();
        }
コード例 #2
0
        public ResourceGroup updatePriority(IResourceRef ref_, int DesignPriority)
        {
            SortGroup();
            int index = ResourceRefs.IndexOf(ref_);

            ResourceRefs.Remove(ref_);
            ResourceRefs.Insert(DesignPriority - 1, ref_);
            for (int i = 0; i < ResourceRefs.Count; i++)
            {
                ResourceRefs[i].Priority = i + 1;
            }
            return(this);
        }
コード例 #3
0
        public void LoadConfig(JsonData data)
        {
            var temp = this;
            ResourceGroupSerializer resSerializer = JsonMapper.ToObject <ResourceGroupSerializer> (data.ToJson());

            foreach (var r in resSerializer.ResourceRefs)
            {
                IResourceRef resRef;
                resRef = new IResourceRef(manager.ResourceManager.Containor.GetResourceByGUID(r.GUID), r.Priorty);
                ResourceRefs.Add(resRef);
            }
            resSerializer.ConvertToResourceGroup(ref temp);
        }