public void Refreash() { ShortCutData data = ShortCutDataManager.Instance.datas[index]; if (null == icon) { return; } if (data.type == SHORTCUTITEM.SKILL) { icon.atlas = UIAtlasManager.GetInstance().GetUIAtlas("SkillAtlas"); icon.spriteName = "" + itemId; } else if (data.type == SHORTCUTITEM.ITEM) { icon.atlas = null; icon.spriteName = ""; } else { if (icon.atlas != null) { icon.atlas = null; icon.spriteName = ""; } } }
public override void SetGray(bool gray) { if (image) { if (gray) { if (image != null && image.sprite != null) { bool isSuccess = UIAtlasManager.GetInstance().SetAtlasMaterial(image, image.sprite.name + ".png", true); if (!isSuccess) { image.material = GrayMaterial; } } } else { if (image != null && image.sprite != null) { bool isSuccess = UIAtlasManager.GetInstance().SetAtlasMaterial(image, image.sprite.name + ".png"); if (!isSuccess) { image.material = null; } } } } }
//二维码语音 IEnumerator PlayVoiceIe() { int tTime = 0; int index = 0; int cTime = 0; int cRunTime = 0; int count = elist.Count; while (tTime <= 60) { if (cRunTime >= cTime)//此时语音已播完 { animator.enabled = false; xiaoP.sprite = UIAtlasManager.LoadSprite(UIAtlasName.UIQRCode, "1"); } if (index < count && elist[index].Time == tTime.ToString()) { animator.enabled = true; SDKManager.Instance.Speak(elist[index].TimeContent); cTime = Convert.ToInt32(elist[index].WinTime); cRunTime = 0; index++; } yield return(new WaitForSeconds(1)); cRunTime++; tTime++; } SDKManager.Instance.CustomQuit(); }
protected override void PreInit() { headAtlas = UIAtlasManager.GetInstance().GetUIAtlas("HeadAtlas"); friendAtlas = UIAtlasManager.GetInstance().GetUIAtlas("FriendAtlas"); bg = FindUIObject <UISprite>("bg"); enemyLab = FindUIObject <UILabel>("enemyLab"); enemySprite = FindUIObject <UISprite>("enemySprite"); friendLab = FindUIObject <UILabel>("friendLab"); friendSprite = FindUIObject <UISprite>("friendSprite"); grid = GameObject.Find("Panel").GetComponent <UIGrid>(); imageSign = FindUIObject <UISprite>("imageSign"); inside = FindUIObject <UISprite>("inside"); levelLab = FindUIObject <UILabel>("levelLab"); myImage = FindUIObject <UISprite>("myImage"); myTitleBg = FindUIObject <UISprite>("myTitleBg"); nameLab = FindUIObject <UILabel>("nameLab"); slider = FindUIObject <UISlider>("slider"); slider.value = 1; sortBg = FindUIObject <UISprite>("sortBg"); sortLab = FindUIObject <UILabel>("sortLab"); title = FindUIObject <UISprite>("title"); //up = FindUIObject<UISprite>("up"); addBtn = FindUIObject <UIImageButton>("addBtn"); closeBtn = FindUIObject <UIImageButton>("closeBtn"); SetMyInfo(); createFriendLab(); }
protected virtual void ConfigUI() { iconAtlas = UIAtlasManager.GetInstance().GetUIAtlas("SkillAtlas"); icon = NGUITools.AddChild <UISprite>(gameObject); icon.atlas = iconAtlas; icon.spriteName = "lock"; icon.MakePixelPerfect(); }
private void RestStartUpdate() { num1 = 3; num2 = 0; time_1.overrideSprite = UIAtlasManager.LoadSprite(UIAtlasName.UIMain, num1.ToString()); time_2.overrideSprite = UIAtlasManager.LoadSprite(UIAtlasName.UIMain, num2.ToString()); aciton = null; aciton = NormalUpdate; }
//产生事件类型 public void GenerateEvent() { UISprite uiGo = MonoGameObjectPool <UISprite> .Instance.GetUIGameObject(); uiGo.atlas = UIAtlasManager.GetInstance().GetUIAtlas(ResourceAtlasName); uiGo.spriteName = fightType.ToString().Substring(2).ToLower(); uiGo.MakePixelPerfect(); uiGo.transform.parent = this.transform; }
public static UIAtlasManager GetInstance() { if (_instance == null) { _instance = new UIAtlasManager(); //GOERoot.Scene.OnLeaveScene += _instance.OnEnterScene; UIAtlasInfo.OnInit(); } return(_instance); }
protected override void Init() { base.Init(); UIEventListener.Get(CloseButton.gameObject).onClick += OnClickClose; UIEventListener.Get(ChangeButton.gameObject).onClick += OnClickChange; UIAtlas atlas = UIAtlasManager.GetInstance().GetUIAtlas("IconAtlas"); EquipSprite.atlas = atlas; EquipSprite.type = UISprite.Type.Sliced; EquipSprite.spriteName = "ItemBg"; UpdateEquipInfo(); }
protected virtual void ConfigUI() { iconAtlas = UIAtlasManager.GetInstance().GetUIAtlas("SkillAtlas"); icon = NGUITools.AddChild <UISprite>(gameObject); icon.atlas = iconAtlas; icon.spriteName = "lock"; icon.depth = 100; icon.MakePixelPerfect(); drag = gameObject.AddComponent <DragItem>(); drag.DragType = DRAG_TYPE; }
//装载Atlas资源 void LoadResource() { UIAtlasManager.GetInstance().AddResource("OtherAtlas"); UIAtlasManager.GetInstance().AddResource("EquipAtlas"); UIAtlasManager.GetInstance().AddResource("SkillAtlas"); UIAtlasManager.GetInstance().AddResource("IconAtlas"); UIAtlasManager.GetInstance().AddResource("CommonAtlas"); UIAtlasManager.GetInstance().AddResource("Common2Atlas"); UIAtlasManager.GetInstance().AddResource("ChatsystemAtlas"); UIAtlasManager.GetInstance().OnLoadComplete += UIAtlas_OnLoadComplete; UIAtlasManager.GetInstance().Load(); }
protected void AddIcon() { background = NGUITools.AddChild <UISprite>(gameObject); background.atlas = UIAtlasManager.GetInstance().GetUIAtlas(); background.MakePixelPerfect(); iconAtlas = UIAtlasManager.GetInstance().GetUIAtlas("IconAtlas"); icon = NGUITools.AddChild <UISprite>(gameObject); icon.atlas = iconAtlas; icon.MakePixelPerfect(); numTxt = NGUITools.AddChild <UILabel>(gameObject); numTxt.font = FontManager.GetInstance().Font; }
//设置曲线值 private void SetQuXImg() { Sprite sp = quxian.sprite; int random = 0; while (sp == quxian.sprite) { random = UnityEngine.Random.Range(1, 4); sp = UIAtlasManager.LoadSprite(UIAtlasName.UIMain, "Bo-0" + random); } quxian.sprite = sp; SDKManager.Instance.randomQuXian = random;//就一种速度 }
protected override void PreInit() { base.PreInit(); atlas = UIAtlasManager.GetInstance().GetUIAtlas("ChatsystemAtlas"); background.atlas = atlas; background.spriteName = "选项弹出底"; background.pivot = UIWidget.Pivot.Top; useLabel.transform.localScale = new Vector3(scaleX, scaleY, scaleZ); useLabel.transform.localPosition = new Vector3(useLabel.transform.localPosition.x, useLabel.transform.localPosition.y, 0); NGUITools.AddWidgetCollider(useLabel.gameObject); BoxCollider collider = useLabel.gameObject.GetComponent <BoxCollider>(); collider.center = new Vector3(collider.center.x, collider.center.y, 0); useallLabel.transform.localPosition = new Vector3(useLabel.transform.localPosition.x, useLabel.transform.localPosition.y - space, 0); useallLabel.transform.localScale = new Vector3(scaleX, scaleY, scaleZ); NGUITools.AddWidgetCollider(useallLabel.gameObject); collider = useallLabel.gameObject.GetComponent <BoxCollider>(); collider.center = new Vector3(collider.center.x, collider.center.y, 0); partLabel.transform.localPosition = new Vector3(useLabel.transform.localPosition.x, useallLabel.transform.localPosition.y - space, 0); partLabel.transform.localScale = new Vector3(scaleX, scaleY, scaleZ); NGUITools.AddWidgetCollider(partLabel.gameObject); collider = partLabel.gameObject.GetComponent <BoxCollider>(); collider.center = new Vector3(collider.center.x, collider.center.y, 0); saleLabel.transform.localPosition = new Vector3(useLabel.transform.localPosition.x, partLabel.transform.localPosition.y - space, 0); saleLabel.transform.localScale = new Vector3(scaleX, scaleY, scaleZ); NGUITools.AddWidgetCollider(saleLabel.gameObject); collider = saleLabel.gameObject.GetComponent <BoxCollider>(); collider.center = new Vector3(collider.center.x, collider.center.y, 0); showLabel.transform.localPosition = new Vector3(useLabel.transform.localPosition.x, saleLabel.transform.localPosition.y - space, 0); showLabel.transform.localScale = new Vector3(scaleX, scaleY, scaleZ); NGUITools.AddWidgetCollider(showLabel.gameObject); collider = showLabel.gameObject.GetComponent <BoxCollider>(); collider.center = new Vector3(collider.center.x, collider.center.y, 0); dropLabel.transform.localPosition = new Vector3(useLabel.transform.localPosition.x, showLabel.transform.localPosition.y - space, 0); dropLabel.transform.localScale = new Vector3(scaleX, scaleY, scaleZ); NGUITools.AddWidgetCollider(dropLabel.gameObject); collider = dropLabel.gameObject.GetComponent <BoxCollider>(); collider.center = new Vector3(collider.center.x, collider.center.y, 0); }
/// <summary> /// 游戏推出 /// </summary> public void AppQuit() { Debug.Log("退出游戏AppQuit"); WonDoll(false); gameStatus.SetAllPro(GameRunStatus.GameEnd, false, basicTimes); UIManager.Instance.Clear(); UIAtlasManager.Clear(); AudioManager.Instance.Clear(); EventHandler.Clear(); EffectMrg.Clear(); LoadAssetMrg.Instance.Dispose(); GC.Collect(); Application.Quit(); }
public void showTips(EquipInfo info) { mItem = info; if (!bInited) { return; } UIAtlas atlas = UIAtlasManager.GetInstance().GetUIAtlas("IconAtlas"); ItemFrame.spriteName = info.Icon; ItemFrame.atlas = atlas; Name.text = info.Name; Description.text = info.Tips; }
//设置警察图片 private void SetPoliceImg(bool isShoot) { string imgName = ""; if (isShoot) { imgName = "police_shoot"; police_img.transform.localPosition = new Vector3(53, 106, 0); } else { imgName = "police_idel"; police_img.transform.localPosition = new Vector3(0, 116, 0); } police_img.sprite = UIAtlasManager.LoadSprite(UIAtlasName.UIMain, imgName); police_img.SetNativeSize(); }
private void ShowAward(RemoteTable award) { int nMoney = award["nMoney"]; int nExp = award["nExp"]; MoneyLabel.text = nMoney.ToString(); ExpLabel.text = nExp.ToString(); RemoteTable ItemTypes = (RemoteTable)award["ItemTypes"]; RemoteTable ItemIndexs = (RemoteTable)award["ItemIndexs"]; RemoteTable ItemAmouts = (RemoteTable)award["ItemAmouts"]; for (int i = 0; i < 5; i++) { Items[i].gameObject.SetActive(false); ItemNum[i].gameObject.SetActive(false); } for (int i = 0; i < 3; i++) { Stars[i].gameObject.SetActive(false); } int nCount = ItemTypes.dictKV.Count; for (int i = 1; i <= nCount; i++) { int nItemType = ItemTypes[i]; int nItemIndex = ItemIndexs[i]; int nItemAmouts = ItemAmouts[i]; UIAtlas atlas = UIAtlasManager.GetInstance().GetUIAtlas("IconAtlas"); Items[i - 1].atlas = atlas; ItemInfo itemVO = ItemLocator.GetInstance().GetItemVO(nItemIndex, (byte)nItemType); Items[i - 1].gameObject.SetActive(true); Items[i - 1].spriteName = itemVO.Icon; ItemNum[i - 1].gameObject.SetActive(true); ItemNum[i - 1].text = "X" + nItemAmouts; } BlackBGSprite.gameObject.transform.localScale = new Vector3(3, 3, 3); }
private void SetItemData(int itemPos, int itemType, string Icon, int itemNum) { string atlasName = null; string spriteName = Icon; switch (itemType) { case (int)KItemTableType.ittEquip: atlasName = EQUIPATLAS; KTabLineEquip equipData = KConfigFileManager.GetInstance().equipTabInfos.getData(Icon); if (equipData != null) { spriteName = equipData.Icon;; } break; case (int)KItemTableType.ittOther: atlasName = OTHERATLAS; break; default: atlasName = DEFAULTATLAS; break; } ItemFrameSpriteList[itemPos - 1].gameObject.SetActive(true); ItemSpriteList[itemPos - 1].depth = ItemFrameSpriteList[itemPos - 1].depth + 100; ItemSpriteList[itemPos - 1].atlas = UIAtlasManager.GetInstance().GetUIAtlas(atlasName); ItemSpriteList[itemPos - 1].spriteName = spriteName; ItemNumList[itemPos - 1].depth = ItemFrameSpriteList[itemPos - 1].depth + 105; if (itemNum > 9999) { float fNum = itemNum / 10000.0f; ItemNumList[itemPos - 1].text = fNum.ToString() + "万"; } else { ItemNumList[itemPos - 1].text = itemNum.ToString(); } }
private void NormalUpdate() { int number = 30 - Convert.ToInt32(num1 + "" + num2); PlayingAction(number); if (num2 == 0) { num2 = 9; num1--; } else { num2--; } if (num1 >= 0 && num2 >= 0) { time_1.overrideSprite = UIAtlasManager.LoadSprite(UIAtlasName.UIMain, num1.ToString()); time_2.overrideSprite = UIAtlasManager.LoadSprite(UIAtlasName.UIMain, num2.ToString()); } }
protected void ConfigUI() { background = NGUITools.AddChild <UISprite>(gameObject); background.transform.localScale = new Vector3(48, 48, 1); UIAtlas atlas = UIAtlasManager.GetInstance().GetUIAtlas("IconAtlas"); background.atlas = atlas; background.type = UISprite.Type.Sliced; background.spriteName = "ItemBg"; icon = NGUITools.AddChild <UISprite>(gameObject); icon.transform.localScale = new Vector3(40, 40, 1); icon.atlas = atlas; icon.spriteName = "icon11"; drag = gameObject.AddComponent <DragItem>(); drag.DragIcon = icon; drag.DragType = DRAG_TYPE; drag.DropEvent += DoDrop; drag.ToolTipEvent += DoToolTip; }
public void AlertWindows(EquipInfo info, int time) //, AlertCallBackDelegate alertCallBack { // alertCallBack; this.info = info; this.time = time; if (!bInited) { return; } UIAtlas atlas = UIAtlasManager.GetInstance().GetUIAtlas("IconAtlas"); EquipIcon.spriteName = info.Icon; EquipIcon.atlas = atlas; Text.text = "正在进行<9932CC>" + info.Name + "<->的<00BFFF>进阶<->"; // startTime = this.time + Time.time; ShowProcess(); if (this.time > 0) { isCountDown = true; } }
public override void SetGray(bool gray) { if (sprite) { if (gray) { bool isSuccess = UIAtlasManager.GetInstance().SetAtlasMaterial(sprite, LazyLoader.SpriteName, true); if (!isSuccess) { sprite.material = GrayMaterial; } } else { bool isSuccess = UIAtlasManager.GetInstance().SetAtlasMaterial(sprite, LazyLoader.SpriteName); if (!isSuccess) { sprite.material = null; } } } }
static UIAtlasManager() { instance = new UIAtlasManager(); }
//创建物体 void CreateGameObject() { GameObject tempObj = null; GameEntity entity = null; if (modelWheel && parentWheel) { Image img; Text duiImg; Text duiImg2; Sprite sp = null; if (modelWheel && parentWheel) { for (int i = 0; i < 14; i++) { float posX = i * 86; if (i == 0) { tempObj = modelWheel; tempObj.SetActive(true); } else { tempObj = CommTool.InstantiateObj(modelWheel, parentWheel, new Vector3(posX, 0, 0), Vector3.one * wheel, "wheels" + i); } tempObj.transform.GetComponent <Image>().overrideSprite = sp; entity = new GameEntity(tempObj); list.Add(entity); } } if (modelPang && parentPang) { tempPange = CommTool.InstantiateObj(modelPang, parentPang, Vector3.zero, Vector3.one * xiaoPang, "tempPange"); img = tempPange.GetComponent <Image>(); duiImg2 = CommTool.GetCompentCustom <Text>(tempPange, "dui"); tempPange.SetActive(false); string img_name = "j-"; string new_name = string.Empty; Vector3 pos = Vector3.zero; for (int i = 0; i < 4; i++) { int num = i + 1; new_name = img_name + num; if (i == 0) { tempObj = modelPang; tempObj.name = new_name; tempObj.SetActive(true); } else { pos.x = i * 380; tempObj = CommTool.InstantiateObj(modelPang, parentPang, pos, Vector3.one * xiaoPang, new_name); } sp = UIAtlasManager.LoadSprite(UIAtlasName.UIMain, new_name); tempObj.transform.GetComponent <Image>().overrideSprite = sp; duiImg = CommTool.GetCompentCustom <Text>(tempObj, "dui"); entity = new GameEntity(tempObj, img, sp, duiImg, duiImg2); listPang.Add(entity); } for (int i = 0; i < 4; i++) { if (i == 0) { listPang[i].last = listPang[3]; } else { listPang[i].last = listPang[i - 1]; } } } } }
private UIAtlas GetAtlas(string UIAtlasName) { atlas = UIAtlasManager.GetInstance().GetUIAtlas(UIAtlasName); return(atlas); }
void UIAtlas_OnLoadComplete() { UIAtlasManager.GetInstance().OnLoadComplete -= UIAtlas_OnLoadComplete; progressValue = 0.2f; LoadRoleBaseData(); }