static int InstancePrefab(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 3) { string arg0 = ToLua.CheckString(L, 1); string arg1 = ToLua.CheckString(L, 2); LuaFunction arg2 = ToLua.CheckLuaFunction(L, 3); ResourceLoad.InstancePrefab(arg0, arg1, arg2); return(0); } else if (count == 4) { string arg0 = ToLua.CheckString(L, 1); string arg1 = ToLua.CheckString(L, 2); UnityEngine.Transform arg2 = (UnityEngine.Transform)ToLua.CheckObject <UnityEngine.Transform>(L, 3); LuaFunction arg3 = ToLua.CheckLuaFunction(L, 4); ResourceLoad.InstancePrefab(arg0, arg1, arg2, arg3); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: ResourceLoad.InstancePrefab")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int LoadAsset(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 3 && TypeChecker.CheckTypes <UnityEngine.GameObject, LuaInterface.LuaFunction>(L, 2)) { string arg0 = ToLua.CheckString(L, 1); UnityEngine.GameObject arg1 = (UnityEngine.GameObject)ToLua.ToObject(L, 2); LuaFunction arg2 = ToLua.ToLuaFunction(L, 3); ResourceLoad.LoadAsset(arg0, arg1, arg2); return(0); } else if (count == 3 && TypeChecker.CheckTypes <UnityEngine.Transform, LuaInterface.LuaFunction>(L, 2)) { string arg0 = ToLua.CheckString(L, 1); UnityEngine.Transform arg1 = (UnityEngine.Transform)ToLua.ToObject(L, 2); LuaFunction arg2 = ToLua.ToLuaFunction(L, 3); ResourceLoad.LoadAsset(arg0, arg1, arg2); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: ResourceLoad.LoadAsset")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
private IEnumerator DoInitalize() { LoadingQueue loadQueue = new LoadingQueue(this); loadQueue.CacheEffect(RESOURCE_CATEGORY.EFFECT_UI, $"ef_ui_pointresult_{currentData.eventId:D8}"); if (loadQueue.IsLoading()) { yield return((object)loadQueue.Wait()); } SetVisibleWidgetEffect(UI.TXT_BANNER, $"ef_ui_pointresult_{currentData.eventId:D8}"); UIVisibleWidgetEffect visibleWidget = bannerCtrl.GetComponent <UIVisibleWidgetEffect>(); visibleWidget.SetRendererQueue(4000); PlayAudio(AUDIO.TITLE_LOGO); ResourceLoad.LoadEventBannerResultTexture(GetCtrl(UI.SPR_LOGO).GetComponent <UITexture>(), (uint)currentData.eventId); ResourceLoad.LoadEventBannerResultBGTexture(GetCtrl(UI.SPR_LOGO_BG).GetComponent <UITexture>(), (uint)currentData.eventId); TweenAlpha logoBGAlpha = GetCtrl(UI.SPR_LOGO_BG).GetComponent <TweenAlpha>(); if (logoBGAlpha != null) { logoBGAlpha.ResetToBeginning(); logoBGAlpha.PlayForward(); } base.Initialize(); }
protected override void SetQuestData(QuestTable.QuestTableData questData, Transform t) { SetLabelText(t, UI.LBL_QUEST_NAME, questData.questText); UITexture component = FindCtrl(t, UI.TEX_RUSH_IMAGE).GetComponent <UITexture>(); ResourceLoad.LoadWithSetUITexture(component, RESOURCE_CATEGORY.RUSH_QUEST_ICON, ResourceName.GetRushQuestIconName((int)questData.rushIconId)); }
public void LogHealthState() { ResourceLoad currentLoad = this.GetCurrentLoad(); WlmHealthCounters customHealthCounters = this.healthTracker.GetCustomHealthCounters(); WLMResourceStatsData loggingStatsData = new WLMResourceStatsData { OwnerResourceName = this.Owner.ResourceName, OwnerResourceGuid = this.Owner.ResourceGuid, OwnerResourceType = this.Owner.ResourceType, WlmResourceKey = this.WlmResourceKey.ToString(), DynamicCapacity = (double)this.DynamicCapacity, LoadState = currentLoad.State.ToString(), LoadRatio = currentLoad.LoadRatio, Metric = ((currentLoad.Metric != null) ? currentLoad.Metric.ToString() : string.Empty), IsDisabled = (this.IsDisabled ? "true" : null), DynamicThrottingDisabled = (this.DynamicThrottlingDisabled ? "true" : null), TimeInterval = this.healthTracker.CustomTimeInterval, UnderloadedCount = customHealthCounters.UnderloadedCounter, FullCount = customHealthCounters.FullCounter, OverloadedCount = customHealthCounters.OverloadedCounter, CriticalCount = customHealthCounters.CriticalCounter, UnknownCount = customHealthCounters.UnknownCounter }; WLMResourceStatsLog.Write(loggingStatsData); }
public void sendMultReports() { DateTime dtstartUTC = DateTime.UtcNow.AddSeconds(-6); Resource resource = new ResourceLoad("resource1"); ResourcesHelper.SendReportTester sendReportTester = new ResourcesHelper.SendReportTester(); Resources resources = new Resources(); resources.addResource(resource); // this object will check that the reports have multiple intervals resources.setCallback(sendReportTester); resources.startThread(); // sleep for 11 seconds to allow at least one interval to be captured System.Threading.Thread.Sleep(10000); // add two report requests that request the same rid resources.addCreateReport(ResourcesHelper.GenerateCreateReport.generateCreateReport(dtstartUTC, "reportRequestID_1", resources.TelemetryStatusReportSpecifierID)); System.Threading.Thread.Sleep(1000); resources.addCreateReport(ResourcesHelper.GenerateCreateReport.generateCreateReport(dtstartUTC.AddSeconds(1), "reportRequestID_2", resources.TelemetryStatusReportSpecifierID)); // System.Threading.Thread.Sleep(40000); System.Threading.Thread.Sleep(120000); resources.stopThread(); }
public void setData(int hero) { id = hero; Image sp = btn.gameObject.GetComponent <Image>(); sp.sprite = ResourceLoad.getHead(hero + ""); }
private void ViewEventTab() { SetActive((Enum)UI.OBJ_NORMAL, false); SetActive((Enum)UI.OBJ_TAB_ROOT, true); SetActive((Enum)UI.OBJ_ON_TAB_NORMAL, false); SetActive((Enum)UI.OBJ_ON_TAB_EVENT, true); SetActive((Enum)UI.OBJ_EVENT_LIST, true); List <PointShop> current = (from x in pointShop where x.isEvent select x).ToList(); SetGrid(UI.GRD_EVENT_LIST, "PointShopEventList", current.Count, true, delegate(int i, Transform t, bool b) { PointShop pointShop = current[i]; UITexture component = FindCtrl(t, UI.TEX_EVENT_LIST_BANNER).GetComponent <UITexture>(); UITexture component2 = FindCtrl(t, UI.TXT_EVENT_LIST_POINT_ICON).GetComponent <UITexture>(); SetLabelText(t, UI.LBL_EVENT_LIST_POINT, string.Format(StringTable.Get(STRING_CATEGORY.POINT_SHOP, 2u), pointShop.userPoint)); ResourceLoad.LoadPointIconImageTexture(component2, (uint)pointShop.pointShopId); ResourceLoad.LoadPointShopBannerTexture(component, (uint)pointShop.pointShopId); SetEvent(FindCtrl(t, UI.TEX_EVENT_LIST_BANNER), "EVENT_SHOP", pointShop); int num = (from x in pointShop.items where x.isBuyable where x.type != 8 || !MonoBehaviourSingleton <UserInfoManager> .I.IsUnlockedStamp(x.itemId) where x.type != 9 || !MonoBehaviourSingleton <UserInfoManager> .I.IsUnlockedDegree(x.itemId) where x.type != 7 || !MonoBehaviourSingleton <GlobalSettingsManager> .I.IsUnlockedAvatar(x.itemId) select x).Count(); bool flag = num == 0; SetActive(t, UI.LBL_EVENT_LIST_SOLD_OUT, flag); SetButtonEnabled(t, UI.TEX_EVENT_LIST_BANNER, !flag); SetLabelText(t, UI.LBL_EVENT_LIST_REMAINING_TIME, pointShop.expire); }); }
private ResourceLoad GetCurrentLoad() { ResourceLoad result; if (this.IsDisabled) { result = ResourceLoad.Zero; } else if (TestIntegration.Instance.AssumeWLMUnhealthyForReservations) { result = new ResourceLoad(12321.0, new int?(12321), null); } else { IResourceLoadMonitor resourceLoadMonitor = ResourceHealthMonitorManager.Singleton.Get(this.WlmResourceKey); if (resourceLoadMonitor == null) { result = new ResourceLoad(24642.0, new int?(24642), null); } else { result = resourceLoadMonitor.GetResourceLoad(this.Owner.WorkloadClassification, false, null); } } this.ResourceHealthPerfCounter.RawValue = (long)result.State; return(result); }
public void setData(SelectModel model) { nameText.text = model.name; if (model.entered) { if (model.heroId == -1) { head.sprite = nullSP; } else { head.sprite = ResourceLoad.getHead(model.heroId + ""); } } else { head.sprite = ResourceLoad.getHead("Image 19"); } if (model.ready) { selected(); } else { img.color = Color.white; } }
private IEnumerator SetPointShopGetPointUI() { if (pointShopGetPointData != null && pointShopGetPointData.Count > 0) { LoadingQueue queue = new LoadingQueue(this); queue.Load(RESOURCE_CATEGORY.COMMON, ResourceName.GetPointIconImageName((int)pointShopGetPointData[0].pointShopId), false); if (queue.IsLoading()) { yield return((object)queue.Wait()); } SetActive((Enum)UI.OBJ_NORMAL_ROOT, true); SetLabelText((Enum)UI.LBL_POINT_NORMAL, string.Format(StringTable.Get(STRING_CATEGORY.POINT_SHOP, 2u), pointShopGetPointData[0].basePoint)); UITexture normalTex = GetCtrl(UI.TEX_NORMAL_ICON).GetComponent <UITexture>(); ResourceLoad.LoadPointIconImageTexture(normalTex, pointShopGetPointData[0].pointShopId); if (pointShopGetPointData.Count >= 2) { queue.Load(RESOURCE_CATEGORY.COMMON, ResourceName.GetPointIconImageName((int)pointShopGetPointData[1].pointShopId), false); if (queue.IsLoading()) { yield return((object)queue.Wait()); } SetActive((Enum)UI.OBJ_EVENT_ROOT, true); SetLabelText((Enum)UI.LBL_POINT_EVENT, string.Format(StringTable.Get(STRING_CATEGORY.POINT_SHOP, 2u), pointShopGetPointData[1].basePoint)); UITexture eventTex = GetCtrl(UI.TEX_EVENT_ICON).GetComponent <UITexture>(); ResourceLoad.LoadPointIconImageTexture(eventTex, pointShopGetPointData[1].pointShopId); } } }
protected override void LoadResource() { SetResourceManagerCreateWithXml("Stage/HudReadyStage"); m_imgBackBoard = GetResource("TEXTURE_ReadyStage_BackBoard").GetComponent <EzGui_Texture>(); m_imgReadyBoard = GetResource("TEXTURE_ReadyStage_ReadyBoard").GetComponent <EzGui_Texture>(); m_imgCharBoard = GetResource("TEXTURE_ReadyStage_CharBoard").GetComponent <EzGui_Texture>(); m_imgItemBoard = GetResource("TEXTURE_ReadyStage_ItemBoard").GetComponent <EzGui_Texture>(); m_btnBlockPos = GetResource("BUTTON_ReadyStage_BlockPosChange").GetComponent <EzGui_Button>(); m_btnBlockSet = GetResource("BUTTON_ReadyStage_BlockSetChange").GetComponent <EzGui_Button>(); m_btnStart = GetResource("BUTTON_ReadyStage_GameStart").GetComponent <EzGui_Button>(); m_btnExit = GetResource("BUTTON_ReadyStage_Exit").GetComponent <EzGui_Button>(); int count = Main.data.GetCount_Item(); if (m_btnItem == null) { m_btnItem = new EzGui_Button[count]; } for (int i = 0; i < count; i++) { SData_Item tmpData = Main.data.GetData_Item(Main.data.GetMenuIndex_Item(i)); string resourcePath = Main.data.GetData_ResourcePath(tmpData.ItemRaster); GameObject tmpObj = ResourceLoad.GetEZGUI_BUTTON(tmpData.ItemRaster, resourcePath, 0, 0, (int)m_imgItemBoard.GetLayer() + 3, HUD_BASE_POS._MIDDLE_CENTER); if (tmpObj != null) { m_btnItem[i] = tmpObj.GetComponent <EzGui_Button>(); m_btnItem[i].GetUIButton().Data = tmpData.ItemIndex; } } }
public static void AddRockImage(GameObject _objParent, int _dSlotIndex, string _strNeed) { GameObject RockImage = ResourceLoad.GetEzGuiTexture(ScrollData.objIconRock_56_76); GameObject RockMent = new GameObject(); RockImage.name = "RockImage_" + _dSlotIndex; RockMent.name = "RockMent_" + _dSlotIndex; ResourceLoad.SetSpriteText_OutLine(RockMent, ScrollData.objSpriteText24, ScrollData.objSpriteText_stroke24); RockMent.GetComponent <EzGui_SpriteText_Outline>().SetColor(new Color(0.7451f, 0.0f, 0.0f), Color.white); RockMent.GetComponent <EzGui_SpriteText_Outline>().SetAnchor(SpriteText.Anchor_Pos.Middle_Center); RockMent.GetComponent <EzGui_SpriteText_Outline>().SetAllignment(SpriteText.Alignment_Type.Center); RockMent.GetComponent <EzGui_SpriteText_Outline>().SetText(_strNeed); if (RockImage.GetComponent <EzGui_Texture>()) { RockImage.GetComponent <EzGui_Texture>().GetEZGUITexture().anchor = SpriteRoot.ANCHOR_METHOD.MIDDLE_CENTER; } // RockImage.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); RockImage.transform.localPosition = m_posRockImage; RockMent.transform.localPosition = m_posRockMent; RockImage.transform.parent = _objParent.transform; RockMent.transform.parent = _objParent.transform; }
public override void Create() { base.Create(); if (objBackground == null) { objBackground = ResourceLoad.GetObject("KittyFace", string.Format("{0}/Model/KittyEffect/Background", ResourceLoad.CheckHeight)); } }
public void active(FightSkill skill, Vector3 position) { icon.sprite = ResourceLoad.getSkillIcon(FightScene.player.heroId + "_" + skill.id); text.text = skill.name; info.text = skill.info; gameObject.transform.localPosition = position; gameObject.SetActive(true); }
public static ResourceLoad GetInstance() { if (instance == null) { instance = new ResourceLoad(); } return(instance); }
public static void AddNewMarkToContainer(GameObject _objContainer, int _dSlotIndex) { GameObject NewMark = ResourceLoad.GetEzGuiTexture(ScrollData.objShopIconNewMark); NewMark.name = "NewMark_" + _dSlotIndex; NewMark.transform.localPosition = m_posNewMark; _objContainer.GetComponent <UIListItemContainer>().MakeChild(NewMark); }
//Credit to Jared Cerbin for coming up with this GUI stuff. void OnGUI() { // Display the GUI only if the game is not paused. Take this out of the 'if' to see why. - Jared if (!isPaused) { Vector2 labelPos = Camera.main.WorldToScreenPoint(transform.position); GUI.Label(new Rect(labelPos.x, Screen.height - labelPos.y - 30, 50, 20), ResourceLoad.ToString("F0")); //I did a slight tweak to not draw the decimial portion of the resource thinger. - Moore } }
public void setIcon(int hero, FightSkill skill) { this.skill = skill; Sprite sp = ResourceLoad.getSkillIcon(hero + "_" + skill.id); mask.sprite = sp; background.sprite = sp; mask.gameObject.SetActive(true); }
private void _viewGemTab() { SetActive(gemTab, true); SetActive(bundleTab, false); SetActive(materialTab, false); CheckOpenedGemTab(); int j = 0; SetTable(gemTab, UI.TBL_LIST, "CrystalShopListItem", _purchaseGemList.Count, false, delegate(int i, Transform p) { ProductData productData2 = _purchaseGemList[j]; if (MonoBehaviourSingleton <GlobalSettingsManager> .I.packParam.HasSpecial(productData2.productId)) { return(Realizes("CrystalShopListItem2", p, true)); } return(null); }, delegate(int i, Transform t, bool b) { ProductData productData = _purchaseGemList[++j]; SetSprite(t, UI.SPR_THUMB, productData.iconImg); SetLabelText(t, UI.LBL_NAME, productData.name); SetLabelText(t, UI.LBL_PRICE, string.Format(base.sectionData.GetText("PRICE"), productData.priceIncludeTax)); SetSupportEncoding(t, UI.LBL_PROMO, true); SetLabelText(t, UI.LBL_PROMO, productData.promo.Replace("\\n", "\n")); if (productData.remainingDay > 0) { SetActive(t, UI.SPR_SOLD, true); SetActive(t, UI.SPR_SOLD_MASK, true); } else { SetActive(t, UI.SPR_SOLD, false); SetActive(t, UI.SPR_SOLD_MASK, false); if (productData.offerType > 0) { UITexture spro = FindCtrl(t, UI.OBJ_OFFER).GetComponent <UITexture>(); ResourceLoad.LoadShopImageGemOfferTexture(spro, (uint)productData.offerType, delegate(Texture tex) { if (spro != null) { spro.mainTexture = tex; } }); } } if (_nativeStoreList != null) { StoreData product = _nativeStoreList.getProduct(productData.productId); if (product != null) { SetLabelText(t, UI.LBL_PRICE, product.price.ToString()); } } SetEvent(t, "BUY", i); }); }
protected override SciterXDef.LoadResult OnLoadData(SciterXDef.SCN_LOAD_DATA sld) { string url = sld.uri; bool is_internal = State.g_el_root == null || sld.principal == State.g_el_root._he || sld.principal == State.g_el_homeroot._he || #if DEBUG url.StartsWith(BaseHost._rescwd) || #endif url.StartsWith("archive://app/"); #if DEBUG bool bOK = true; //Debug.Assert(!is_internal || url.EndsWith("html") || url.EndsWith("tis")); #else bool bOK = State.page_loaded && !is_internal; #endif if (bOK && url.Length != 0) { SciterElement el_pr = sld.principal != IntPtr.Zero ? new SciterElement(sld.principal) : null; SciterElement el_in = sld.initiator != IntPtr.Zero ? new SciterElement(sld.initiator) : null; SciterValue sv = new SciterValue(); sv["url"] = new SciterValue(url); if (el_pr != null) { sv["principal"] = el_pr.ExpandoValue; } if (el_in != null) { sv["initiator"] = el_in.ExpandoValue; } sv["dataType"] = new SciterValue((int)sld.dataType); ResourceLoad resource = new ResourceLoad() { sw = new Stopwatch(), is_internal = is_internal }; resource.sw.Start(); if (!is_internal) { var sv_idx = App.AppHost.CallFunction("Extern_NetworkNewResource", sv); resource.index = sv_idx.Get(-1); } _loading_resources[url] = resource; //bool is_page_source = el_pr.is_child_of(State.g_el_frameroot); //if(is_page_source) } return(base.OnLoadData(sld)); }
public void EditCLValueData(ResourceLoad resourceLoad, CLValue clvalue, UnityAction <object> confirm, UnityAction cancel = null) { var databox = Instantiate(EventDataEditorDialogBoxTemplate, transform).GetComponent <EventDataDialogBox>(); databox.resourceLoad = resourceLoad; databox.SetEventData(clvalue); databox.ConfirmEvent = confirm; databox.CancelEvent = cancel; databox.gameObject.SetActive(true); }
/// <summary> /// 初始化 /// </summary> /// <param name="resourceLoad">资源加载实例</param> public void Init(ResourceLoad resourceLoad) { this.resourceLoad = resourceLoad; foreach (var obj in SelectSignList) { Destroy(obj); } SelectSignList.Clear(); SelectPos = null; SelectLine.gameObject.SetActive(false); }
public static void AddCompMarkToContainer(GameObject _objContainer, int _dSlotIndex, UnityEngine.Object _Prefab) { GameObject CompMark = ResourceLoad.GetEzGuiTexture(_Prefab); CompMark.name = "SlotComp"; // CompMark.name = "Comp_"+_dSlotIndex; CompMark.GetComponent <EzGui_Texture>().SetTextureSize(150.0f, 136.0f); CompMark.transform.localPosition = m_posCompMark; _objContainer.GetComponent <UIListItemContainer>().MakeChild(CompMark); }
public static void AddImageToContainer_MiddleCenter(GameObject _objContainer, int _dSlotIndex, GameObject _objImage, float _fImagePercentage) { //Add Acc GameObject SlotImage = ResourceLoad.GetEzGuiTexture(_objImage); SlotImage.name = m_strSlotImage + _dSlotIndex; SetSlotImage_Middle_Center(SlotImage, _fImagePercentage); SlotImage.transform.localPosition = m_posShopImage_MiddleCenter; _objContainer.GetComponent <UIListItemContainer>().MakeChild(SlotImage); }
public override void UpdateUI() { base.UpdateUI(); UITexture component = GetCtrl(UI.TEX_POINT_ICON).GetComponent <UITexture>(); UITexture component2 = GetCtrl(UI.TEX_EVENT_POP).GetComponent <UITexture>(); ResourceLoad.LoadPointIconImageTexture(component, (uint)data.pointShopId); ResourceLoad.LoadPointShopBGTexture(component2, (uint)data.pointShopId); SetLabelText((Enum)UI.LBL_POINT, string.Format(StringTable.Get(STRING_CATEGORY.POINT_SHOP, 2u), data.userPoint)); SetList(); }
public LoadingQueue(MonoBehaviour mono_behaviour, bool enable_ref_count) { monoBehaviour = mono_behaviour; if (enable_ref_count) { ResourceLoad resourceLoad = ResourceLoad.GetResourceLoad(mono_behaviour, true); if (resourceLoad.list == null) { resourceLoad.list = new BetterList <ResourceObject>(); } } }
private void SetChild() { if (m_dOldNumberCount < m_dNowNumberCount) { for (int i = m_dOldNumberCount; i < m_dNowNumberCount; i++) { GameObject tmpObject = ResourceLoad.GetEzGuiTexture(m_scriptNumberSetManager.GetObjectNumber()); tmpObject.name = string.Format("{0}{1}", "NumberChild_", m_listChild.Count); tmpObject.GetComponent <EzGui_Texture>().SetColor(m_Color); tmpObject.transform.parent = gameObject.transform; tmpObject.GetComponent <EzGui_Texture>().SetValid(Valid); m_listChild.Add(tmpObject); if (m_IsCommaOn) { if (i % 3 == 0 && i != 0) { GameObject tmpObject1 = ResourceLoad.GetEzGuiTexture(m_scriptNumberSetManager.GetObjectNumber()); tmpObject1.name = string.Format("{0}{1}", "NumberChild_", m_listChild.Count); tmpObject1.GetComponent <EzGui_Texture>().SetColor(m_Color); tmpObject1.transform.parent = gameObject.transform; tmpObject1.GetComponent <EzGui_Texture>().SetValid(Valid); m_listChild.Add(tmpObject1); } } } } SetChildPos(); List <int> tmpNumList = new List <int>(); Fuctions.SetNumberList(m_NowNumber, ref tmpNumList); int ListCount = m_listChild.Count; for (int i = 0, count = 0; count < ListCount; i++, count++) { if (m_IsCommaOn) { if (m_dNowNumberCount >= 4) { if ((m_dNowNumberCount - i) % 3 == 0 && i != 0) { m_listChild[count].GetComponent <EzGui_Texture>().GetEZGUITexture().SetUVs(m_scriptNumberSetManager.GetNumberUV(10)); count++; } } } m_listChild[count].GetComponent <EzGui_Texture>().SetcontrolIsEnabled(false); m_listChild[count].GetComponent <EzGui_Texture>().GetEZGUITexture().SetUVs(m_scriptNumberSetManager.GetNumberUV(tmpNumList[i])); } }
public override void SetOption(object obj) { ResourceLoad resource = viewOptions.OtherData as ResourceLoad; var clobj = obj as CL_Object; transform.Find("Name").GetComponent <Text>().text = clobj.Name; var prefabs = resource.GetPrefabsByModelId(clobj.Model); Texture2D texture = resource.ObjectPrefabsTexture2D[clobj.Model]; Sprite sprite = Sprite.Create(texture, new Rect(0, 0, 128, 128), Vector2.zero); GetComponent <Image>().sprite = sprite; }
private void ViewNormalTab() { SetActive((Enum)UI.OBJ_NORMAL, true); SetActive((Enum)UI.OBJ_TAB_ROOT, true); SetActive((Enum)UI.OBJ_ON_TAB_NORMAL, true); SetActive((Enum)UI.OBJ_ON_TAB_EVENT, false); SetActive((Enum)UI.OBJ_EVENT_LIST, false); PointShop shop = pointShop.First((PointShop x) => !x.isEvent); currentPointShopItem = GetBuyableItemList(); if (filter != null) { filter.DoFiltering(ref currentPointShopItem); } SetLabelText((Enum)UI.LBL_NORMAL_POINT, string.Format(StringTable.Get(STRING_CATEGORY.POINT_SHOP, 2u), shop.userPoint)); UITexture component = GetCtrl(UI.TEX_NORMAL_POINT_ICON).GetComponent <UITexture>(); ResourceLoad.LoadPointIconImageTexture(component, (uint)shop.pointShopId); maxPage = currentPointShopItem.Count / GameDefine.POINT_SHOP_LIST_COUNT; if (currentPointShopItem.Count % GameDefine.POINT_SHOP_LIST_COUNT > 0) { maxPage++; } SetLabelText((Enum)UI.LBL_ARROW_NOW, (maxPage <= 0) ? "0" : currentPage.ToString()); SetLabelText((Enum)UI.LBL_ARROW_MAX, maxPage.ToString()); int item_num = Mathf.Min(GameDefine.POINT_SHOP_LIST_COUNT, currentPointShopItem.Count - (currentPage - 1) * GameDefine.POINT_SHOP_LIST_COUNT); SetGrid(UI.GRD_NORMAL, "PointShopListItem", item_num, true, delegate(int i, Transform t, bool b) { int index = i + (currentPage - 1) * GameDefine.POINT_SHOP_LIST_COUNT; object event_data = new object[3] { currentPointShopItem[index], shop, new Action <PointShopItem, int>(OnBuy) }; SetEvent(t, "CONFIRM_BUY", event_data); PointShopItemList component2 = t.GetComponent <PointShopItemList>(); component2.SetUp(currentPointShopItem[index], (uint)shop.pointShopId, currentPointShopItem[index].needPoint <= shop.userPoint); int num = -1; REWARD_TYPE type = (REWARD_TYPE)currentPointShopItem[index].type; if (type == REWARD_TYPE.ITEM) { num = MonoBehaviourSingleton <InventoryManager> .I.GetHaveingItemNum((uint)currentPointShopItem[index].itemId); } SetLabelText(t, UI.LBL_HAVE, string.Format(StringTable.Get(STRING_CATEGORY.POINT_SHOP, 6u), num.ToString())); SetActive(t, UI.LBL_HAVE, num >= 0); }); bool flag = pointShop.Any((PointShop x) => x.isEvent); SetActive((Enum)UI.OBJ_EVENT_NON_ACTIVE, !flag); SetActive((Enum)UI.BTN_EVENT, flag); }