public static void Read() { OfferingGroupList offeringGroupList; UnityEngine.Object oldFile = AssetDatabase.LoadAssetAtPath(outputFileName, typeof(OfferingGroupList)); if (oldFile == null) { offeringGroupList = ScriptableObject.CreateInstance(typeof(OfferingGroupList)) as OfferingGroupList; } else { offeringGroupList = oldFile as OfferingGroupList; } offeringGroupList.dataList.Clear(); string jsonStr = File.ReadAllText(fileName); JsonHashtable ht = FCJson.jsonDecode(jsonStr) as JsonHashtable; foreach (System.Object obj in ht.ValueList) { Hashtable ht2 = obj as Hashtable; OfferingGroup offeringGroup = new OfferingGroup(); offeringGroup.groupId = ht2["groupId"] as string; for (int i = 0; i < 20; i++) { int index = i + 1; SingleGroup group = new SingleGroup(); group.item = ht2["item" + index.ToString()] as string; group.count = (int)ht2["count" + index.ToString()]; if ("" != group.item && group.count > 0) { offeringGroup.groupList.Add(group); } } offeringGroupList.dataList.Add(offeringGroup); } if (!File.Exists(outputFileName)) //new file { AssetDatabase.CreateAsset(offeringGroupList, outputFileName); } else { EditorUtility.SetDirty(offeringGroupList); } }
void Refresh() { float originaly = uiPanel.clipRange.w / 2 - gridOfferingGroup.cellHeight / 2 - 10; uiPanel.clipRange = new Vector4(uiPanel.clipRange.x, -originaly, uiPanel.clipRange.z, uiPanel.clipRange.w); uiPanel.transform.localPosition = new Vector3(uiPanel.clipRange.x, originaly, uiPanel.transform.localPosition.z); bonusDraggablePanel.DisableSpring(); for (int i = 0; i < _offeringGroup.groupList.Count; i++) { SingleGroup sg = _offeringGroup.groupList[i]; ItemData itemData = DataManager.Instance.ItemDataManager.GetItemData(sg.item); if (null == itemData) { continue; } GameObject clone = null; if (_offeringGroupList.ContainsKey(i)) { clone = _offeringGroupList[i].gameObject; } else { clone = NGUITools.AddChild(gridOfferingGroup.gameObject, sampleBonusItem.gameObject); clone.transform.localPosition = sampleBonusItem.transform.localPosition; clone.SetActive(true); _offeringGroupList[i] = clone.GetComponent <OfferingGropSlot>(); } OfferingGropSlot slot = clone.GetComponent <OfferingGropSlot>(); slot.ItemData = itemData; } UIGrid uigrid = gridOfferingGroup.GetComponent <UIGrid>(); uigrid.repositionNow = true; anchor.enabled = true; }
public static async Task <SingleGroup> GetSpecificGroupDetail(string id) { GraphServiceClient graphClient = GraphHelper.GetAuthenticatedClient(); var theGroup = new SingleGroup(); var group = await graphClient.Groups[id].Request().GetAsync(); var photo = await graphClient.Groups[id].Photo.Content.Request().GetAsync(); var ms = new MemoryStream(); photo.CopyTo(ms); var buffer = ms.ToArray(); theGroup.Logo = Convert.ToBase64String(buffer); theGroup.Name = group.DisplayName; theGroup.Description = group.Description; theGroup.Owner = group.Owners; theGroup.Member = group.Members; return(theGroup); }