List <Adslot> bringRewardVideoAdToFront(List <Adslot> adSlotModels) { List <Adslot> newAdSlotModels = new List <Adslot> { }; for (int index = 0; index < adSlotModels.Count; index++) { Adslot adSlot = adSlotModels [index]; if (adSlot.adslot_type == 9) { newAdSlotModels.Insert(0, adSlot); } else { newAdSlotModels.Add(adSlot); } if (KsyunAdSdk.hasLocalAd(adSlot.adslot_id)) { preloadSuccessAdSlotIds.Add(adSlot.adslot_id); } } return(newAdSlotModels); }
void adSlots(int marginTop) { int newMarginTop = 0; for (int index = 0; index < adSlotModels.Count; index++) { newMarginTop = marginTop + (220 + 20) * index; Adslot adSlotModel = adSlotModels [index]; GUIStyle backgroundStyle = new GUIStyle(); backgroundStyle.normal.background = (Texture2D)Resources.Load("appIdInfoBackgroundImage"); GUI.Label(new Rect(20, newMarginTop, Screen.width - 40, 220), "", backgroundStyle); GUIStyle titleLabelStyle = new GUIStyle(); titleLabelStyle.normal.textColor = new Color(0.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f); titleLabelStyle.fontSize = 25; titleLabelStyle.alignment = TextAnchor.MiddleLeft; GUI.Label(new Rect(50, newMarginTop + 10, Screen.width, 50), "广告位Id:" + adSlotModel.adslot_id, titleLabelStyle); GUI.Label(new Rect(50, newMarginTop + 60, Screen.width, 50), "广告位名称:" + adSlotModel.adslot_name, titleLabelStyle); GUI.Label(new Rect(50, newMarginTop + 110, Screen.width, 50), "广告位类型:" + adSlotModel.adslot_type.ToString(), titleLabelStyle); GUI.Label(new Rect(50, newMarginTop + 160, Screen.width, 50), "广告位状态:" + adSlotModel.adslot_status.ToString(), titleLabelStyle); GUIStyle playButtonStyle = new GUIStyle(); if (preloadSuccessAdSlotIds.Contains(adSlotModel.adslot_id)) { playButtonStyle.normal.background = (Texture2D)Resources.Load("playButton_preloadSuccess"); } else if (preloadFailureAdSlotIds.Contains(adSlotModel.adslot_id)) { playButtonStyle.normal.background = (Texture2D)Resources.Load("playButton_preloadFailure"); } else { playButtonStyle.normal.background = (Texture2D)Resources.Load("playButton"); } playButtonStyle.active.background = (Texture2D)Resources.Load("playButton_active"); playButtonStyle.active.textColor = new Color(195.0f / 255.0f, 205.0f / 255.0f, 210.0f / 255.0f); playButtonStyle.normal.textColor = new Color(255.0f / 255.0f, 255.0f / 255.0f, 255.0f / 255.0f); playButtonStyle.fontSize = 35; playButtonStyle.alignment = TextAnchor.MiddleCenter; if (preloadSuccessAdSlotIds.Contains(adSlotModel.adslot_id)) { if (GUI.Button(new Rect(Screen.width - 230 - 40, newMarginTop + (220 - 70 - 20), 230, 70), "缓存广告", playButtonStyle)) { OnShowAdBtnClicked(adSlotModel.adslot_id); } } else if (preloadFailureAdSlotIds.Contains(adSlotModel.adslot_id)) { if (GUI.Button(new Rect(Screen.width - 230 - 40, newMarginTop + (220 - 70 - 20), 230, 70), "缓存失败", playButtonStyle)) { OnShowAdBtnClicked(adSlotModel.adslot_id); } } else { if (GUI.Button(new Rect(Screen.width - 230 - 40, newMarginTop + (220 - 70 - 20), 230, 70), "播放广告", playButtonStyle)) { OnShowAdBtnClicked(adSlotModel.adslot_id); } } } }