public Sprite LoadSprite(string name, string spritePath) { SpriteAtlas atlas = LoadSpriteAtlas(ref spritePath); return(atlas.GetSprite(name)); }
public SpriteEntry(SpriteAtlas atlas, int index) { Sprite = atlas.GetSprite(index); }
public override void OnEnter() { base.OnEnter(); clickAdTime = 0; canvasGroup.alpha = 1; canvasGroup.blocksRaycasts = true; if (Atlas is null) { Atlas = Resources.Load <SpriteAtlas>("RewardPanel"); } rewardType = GameManager.Instance.nextRewardType; rewardNum = GameManager.Instance.nextRewardNum; rewardMutiple = GameManager.Instance.nextRewardMutiple; isSliding = false; hasGet = false; text_nothanks1.color = new Color(1, 1, 1, 0); text_nothanks2.color = new Color(1, 1, 1, 0); text_nothanks2.raycastTarget = false; img_midMutiple.sprite = Atlas.GetSprite(Atlas_UnknownMutiple_Key); img_Light.sprite = Atlas.GetSprite(Atlas_Light_A_Key); btn_close.gameObject.SetActive(false); StartCoroutine("RotateLight"); bool canShowExchange = GameManager.Instance.GetShowExchange(); if (canShowExchange) { text_getextraReward.text = "You have a chance to get cash rewards!"; } else { text_getextraReward.text = "You have a chance to get rewards!"; } switch (rewardType) { case RewardType.Gold: rewardCG.alpha = 1; rewardCG.blocksRaycasts = true; bounusNoticeCG.alpha = 0; bounusNoticeCG.blocksRaycasts = false; img_mid.sprite = Atlas.GetSprite(Atlas_ManyGold_Key); img_rewardicon.sprite = Atlas.GetSprite(Atlas_GoldIcon_Key); text_rewardNum.text = rewardNum.ToString(); btn_adGet.gameObject.SetActive(true); btn_get.gameObject.SetActive(false); StartCoroutine(DelayShowCloseBtn()); slider.SetActive(true); break; case RewardType.Cash: rewardCG.alpha = 1; rewardCG.blocksRaycasts = true; bounusNoticeCG.alpha = 0; bounusNoticeCG.blocksRaycasts = false; img_mid.sprite = Atlas.GetSprite(canShowExchange ? Atlas_ManyCash_B_Key : Atlas_ManyCash_A_Key); img_rewardicon.sprite = Atlas.GetSprite(canShowExchange ? Atlas_CashBIcon_Key : Atlas_CashAIcon_Key); string cashString = rewardNum.ToString(); if (rewardNum < 10) { cashString = cashString.Insert(0, "0.0"); } else if (rewardNum < 100) { cashString = cashString.Insert(0, "0."); } else { cashString = cashString.Insert(cashString.Length - 2, "."); } text_rewardNum.text = cashString; btn_adGet.gameObject.SetActive(true); btn_get.gameObject.SetActive(false); StartCoroutine(DelayShowNothanks(text_nothanks1, 0.53f)); slider.SetActive(true); break; case RewardType.ExtraBonusGold: rewardCG.alpha = 0; rewardCG.blocksRaycasts = false; bounusNoticeCG.alpha = 1; bounusNoticeCG.blocksRaycasts = true; img_mid.sprite = Atlas.GetSprite(Atlas_ManyGold_Key); img_rewardicon.sprite = Atlas.GetSprite(Atlas_GoldIcon_Key); text_rewardNum.text = rewardNum.ToString(); btn_adGet.gameObject.SetActive(false); btn_get.gameObject.SetActive(true); slider.SetActive(false); StartCoroutine(DelayShowNothanks(text_nothanks2)); break; case RewardType.ExtraBonusCash: rewardCG.alpha = 0; rewardCG.blocksRaycasts = false; bounusNoticeCG.alpha = 1; bounusNoticeCG.blocksRaycasts = true; img_mid.sprite = Atlas.GetSprite(canShowExchange ? Atlas_ManyCash_B_Key : Atlas_ManyCash_A_Key); img_rewardicon.sprite = Atlas.GetSprite(canShowExchange ? Atlas_CashBIcon_Key : Atlas_CashAIcon_Key); string cashString1 = rewardNum.ToString(); if (rewardNum < 10) { cashString1 = cashString1.Insert(0, "0.0"); } else if (rewardNum < 100) { cashString1 = cashString1.Insert(0, "0."); } else { cashString1 = cashString1.Insert(cashString1.Length - 2, "."); } text_rewardNum.text = cashString1; btn_adGet.gameObject.SetActive(false); btn_get.gameObject.SetActive(true); slider.SetActive(false); if (GameManager.Instance.CheckFirstSignin(true)) { btn_adOpen.image.sprite = Atlas.GetSprite(Atlas_Open_Key); } else { btn_adOpen.image.sprite = Atlas.GetSprite(Atlas_AdOpen_Key); StartCoroutine(DelayShowNothanks(text_nothanks2)); } break; case RewardType.NoticeBonus: break; case RewardType.SigninGold: rewardCG.alpha = 1; rewardCG.blocksRaycasts = true; bounusNoticeCG.alpha = 0; bounusNoticeCG.blocksRaycasts = false; img_mid.sprite = Atlas.GetSprite(Atlas_ManyGold_Key); img_rewardicon.sprite = Atlas.GetSprite(Atlas_GoldIcon_Key); text_rewardNum.text = string.Format("{0} <size=150><color=#FFE100>x{1}</color></size>", rewardNum, rewardMutiple); rewardNum = (int)(rewardNum * rewardMutiple); btn_adGet.gameObject.SetActive(false); btn_get.gameObject.SetActive(true); slider.SetActive(false); break; case RewardType.SigninCash: rewardCG.alpha = 1; rewardCG.blocksRaycasts = true; bounusNoticeCG.alpha = 0; bounusNoticeCG.blocksRaycasts = false; img_mid.sprite = Atlas.GetSprite(canShowExchange ? Atlas_ManyCash_B_Key : Atlas_ManyCash_A_Key); img_rewardicon.sprite = Atlas.GetSprite(canShowExchange ? Atlas_CashBIcon_Key : Atlas_CashAIcon_Key); string cashString2 = (rewardNum * rewardMutiple).ToString(); if (rewardNum < 10) { cashString2 = cashString2.Insert(0, "0.0"); } else if (rewardNum < 100) { cashString2 = cashString2.Insert(0, "0."); } else { cashString2 = cashString2.Insert(cashString2.Length - 2, "."); } text_rewardNum.text = cashString2; rewardNum = (int)(rewardNum * rewardMutiple); btn_adGet.gameObject.SetActive(false); btn_get.gameObject.SetActive(true); slider.SetActive(false); break; default: PanelManager.Instance.ClosePanel(PanelType.Reward); break; } trans_handle.localPosition = new Vector3(posX[2], 0); img_mid.SetNativeSize(); rect_mid.sizeDelta *= 1.5f; }
/// <summary> /// 从精灵图集得到精灵图 /// </summary> /// <param name="AltasName"></param> /// <param name="SpriteName"></param> /// <returns></returns> public Sprite GetSpriteFromAltas(string AltasName, string SpriteName) { SpriteAtlas SA = Resources.Load <SpriteAtlas> (ALTAS_PATH + AltasName); return(SA.GetSprite(SpriteName)); }
public virtual Sprite GetSpriteByName(string name, SpriteAtlas spriteAtlas) { return(spriteAtlas.GetSprite(name)); }
void GenerateBoard() { GameObject go = Resources.Load <GameObject>(FilePath.TilePrefab); SavedDatabase <TileTypes> tileDB = Globals.campaign.GetTileData().Tiles; int sizeX = currMap.sizeX; int sizeY = currMap.sizeY; pathfinding = new Pathfinding(sizeX, sizeY); EffectBoard = new TileEffectSprite[sizeX, sizeY]; for (int x = 0; x < sizeX; x++) { for (int y = 0; y < sizeY; y++) { //Heres where we'll probably adjust the height map stuff GameObject temp = Instantiate(go, transform); TileData data = new TileData(x, y); // maybe we should create a new board that will just replace the board in the current // map? TileTypes types = tileDB.GetCopy(currMap.tileBoard[x, y]); //currMap.tileBoard[x, y] = types; Tile newTile = temp.GetComponent <Tile>(); temp.GetComponent <Tile>().InitTile(data, types); pathfinding.AddTile(newTile, x, y); // temp.transform.position = Globals.HeightCorrectedPosition(pathfinding.tiles[x, y]); temp.transform.position = Globals.GridToWorld(x, y); temp.GetComponent <SpriteRenderer>().sprite = atlas.GetSprite(types.spriteFilePath); temp.name = x + " " + y; // we create a concection between the tile effects on the map and the } } if (currentMission.started == false) { foreach (Tuple <MapCoords, List <string> > key in currentMission.initTileEffects) { int x = key.ele1.X; int y = key.ele1.Y; List <TileEffect> effects = new List <TileEffect>(); foreach (string s in key.ele2) { effects.Add(Globals.campaign.GetTileData().Effects.GetCopy(s)); } pathfinding.tiles[x, y].tileEffects = effects; pathfinding.tiles[x, y].InitTileEffect(); pathfinding.tiles[x, y].InitTileEffectsVisuals(); pathfinding.tiles[x, y].ProcessEffectQueue(); } } pathfinding.PopulateNieghbors(); }
private void ChangeSprite() { _renderer.sprite = _atlas.GetSprite(_config.names[_config.index]); }
void Start() { gameObject.GetComponent <Image>().sprite = UISpriteAtlas.GetSprite("TitleBackground"); }
public Sprite GetBuffSprite(string name) { return(UISprite.GetSprite(name)); }
Image[] newIcon = default; // 新たに手に入れた時にボタンの上に表示するのアイコン /// <summary> /// 起動処理. /// </summary> void Awake() { // 各スプライトをアタッチ pictureBookButton.sprite = atlas.GetSprite(SpriteName.PictureBookButton); leaderboardButton.sprite = atlas.GetSprite(SpriteName.LeaderboardButton); shareButton.sprite = atlas.GetSprite(SpriteName.ShareButton); achievementButton.sprite = atlas.GetSprite(SpriteName.Achievement); skinButton.sprite = atlas.GetSprite(SpriteName.SkinButton); page.sprite = atlas.GetSprite(SpriteName.Page); dish.sprite = atlas.GetSprite(SpriteName.Dish); shareIcon.sprite = atlas.GetSprite(SpriteName.ShareIcon); scoreMochi[(int)ScoreManager.Score.Low].sprite = atlas.GetSprite(SpriteName.LowScoreMochi); scoreMochi[(int)ScoreManager.Score.Normal].sprite = atlas.GetSprite(SpriteName.NormalScoreMochi); scoreMochi[(int)ScoreManager.Score.Good].sprite = atlas.GetSprite(SpriteName.GoodScoreMochi); scoreMochi[(int)ScoreManager.Score.VeryGood].sprite = atlas.GetSprite(SpriteName.VeryGoodScoreMochi); for (int i = 0; i < menuButton.Length; i++) { menuButton[i].sprite = atlas.GetSprite(SpriteName.MenuButton); } for (int i = 0; i < window.Length; i++) { window[i].sprite = atlas.GetSprite(SpriteName.Window); } for (int i = 0; i < newIcon.Length; i++) { newIcon[i].sprite = atlas.GetSprite(SpriteName.NewIcon); } }
public Sprite RequestSprite(string spriteName) { return(myAtlas.GetSprite(spriteName)); }
void Start() { gameObject.GetComponent <Image>().sprite = UISpriteAtlas.GetSprite("CheckMark_Image"); }
public Sprite GetLanguageSprite(Language language) { Sprite result = uiSpriteAtlas.GetSprite(language.ToString().ToLower()); return(result); }
public Sprite GetBlockImage(Pyramid_BlockType blockType) { return(blockAtlas.GetSprite(blockType.ToString())); }
public Sprite GetSprite(SpriteAtlas_Name spriteAtlas_Name, string sprite_name) { string spritePath = spriteAtlas_Name + "/" + sprite_name; if (loadedSpriteDic.TryGetValue(spritePath, out Sprite loadedSprite)) { if (loadedSprite is null) { Debug.LogError("获取精灵图片错误:已加载精灵图片字典中存在该键,但对应的精灵图片为空!精灵图片的路径为:" + spritePath); loadedSpriteDic.Remove(spritePath); return(null); } else { return(loadedSprite); } } else { if (loadedSpriteAtlasDic.TryGetValue(spriteAtlas_Name, out SpriteAtlas loadedSpriteAtlas)) { if (loadedSpriteAtlas is null) { Debug.LogError("获取精灵图片错误:已经加载的精灵图集字典中存在该图集的键,但对应的图集为空!图集名称为:" + spriteAtlas_Name); loadedSpriteAtlasDic.Remove(spriteAtlas_Name); return(null); } else { Sprite targetSprite = loadedSpriteAtlas.GetSprite(sprite_name); if (targetSprite is null) { Debug.LogError("获取精灵图片错误:精灵图集中不存在该名称的精灵图片!精灵图片的名称为:" + sprite_name); return(null); } else { loadedSpriteDic.Add(spritePath, targetSprite); return(targetSprite); } } } else { if (spriteAtlasPathDic.TryGetValue(spriteAtlas_Name, out string spriteAtlasPath)) { if (string.IsNullOrEmpty(spriteAtlasPath)) { Debug.LogError("获取精灵图片错误:精灵图片所在图集的路径为空!图集名称为:" + spriteAtlas_Name); return(null); } else { SpriteAtlas targetSpriteAtlas = Resources.Load <SpriteAtlas>(spriteAtlasPath); if (targetSpriteAtlas is null) { Debug.LogError("获取精灵图片错误:请确认图集的路径是正确的!图集路径:" + spriteAtlasPath); return(null); } else { loadedSpriteAtlasDic.Add(spriteAtlas_Name, targetSpriteAtlas); Sprite targetSprite = targetSpriteAtlas.GetSprite(sprite_name); if (targetSprite is null) { Debug.LogError("获取精灵图片错误:精灵图集中不存在该名称的精灵图片!精灵图片的名称为:" + sprite_name); return(null); } else { loadedSpriteDic.Add(spritePath, targetSprite); return(targetSprite); } } } } else { Debug.LogError("获取精灵图片错误:精灵图集字典中不存在该图集的路径!图集名称为:" + spriteAtlas_Name); return(null); } } } }
public void SetTargetFormNumSprite(Image targetFormSprite) { targetFormNumber = Random.Range(0, 8); targetFormSprite.sprite = atlas.GetSprite(Constants.blockPhase + "-" + targetFormNumber); }
void Start() { gameObject.GetComponent <Image>().sprite = UISpriteAtlas.GetSprite("player_mark"); }
public void Init(SkillData skillData) { SpriteAtlas sa = ResManager.Instance.Load <SpriteAtlas>("UI/Skill/SkillAtlas"); skillImage.sprite = sa.GetSprite(skillData.icon); }
public Sprite GetSprite(string spriteName) { Sprite icon = itemIconSpriteAtlas.GetSprite(spriteName); return(icon); }
public void DisPlay(RowHeroDate date) { _Date = date; Level.text = date.Level.ToString(); Name.text = date.Name.ToString(); string[] iconData = date.Icon.Split('#'); SpriteAtlas iconAtlas = Resources.Load <SpriteAtlas>("Img/SpriteAtlas/" + iconData[0]); AvatarIcon.sprite = iconAtlas.GetSprite(iconData[1]); SpriteAtlas FrameIconAtlas = Resources.Load <SpriteAtlas>("Img/SpriteAtlas/FrameAtlas"); switch (date.Type) { case "航母": TypeIcon.sprite = FrameIconAtlas.GetSprite("hangmu"); break; case "重巡": TypeIcon.sprite = FrameIconAtlas.GetSprite("zhongxun"); break; case "轻巡": TypeIcon.sprite = FrameIconAtlas.GetSprite("qingxun"); break; case "战列舰": TypeIcon.sprite = FrameIconAtlas.GetSprite("zhanlie"); break; case "驱逐": TypeIcon.sprite = FrameIconAtlas.GetSprite("quzhu"); break; } SpriteAtlas BgIconAtlas = Resources.Load <SpriteAtlas>("Img/SpriteAtlas/Detail_CardBgAtlas"); switch (date.ColorType) { case "mix": BgIcon.sprite = BgIconAtlas.GetSprite("Mix_Bg"); Frame.sprite = FrameIconAtlas.GetSprite("Mix_Frame"); break; case "gold": BgIcon.sprite = BgIconAtlas.GetSprite("Gold_Bg"); Frame.sprite = FrameIconAtlas.GetSprite("Gold_Frame"); break; case "purple": BgIcon.sprite = BgIconAtlas.GetSprite("Purple_Bg"); Frame.sprite = FrameIconAtlas.GetSprite("Purple_Frame"); break; case "blue": BgIcon.sprite = BgIconAtlas.GetSprite("Blue_Bg"); Frame.sprite = FrameIconAtlas.GetSprite("Blue_Frame"); break; case "white": BgIcon.sprite = BgIconAtlas.GetSprite("Gray_Bg"); Frame.sprite = FrameIconAtlas.GetSprite("Gray_Frame"); break; } for (int i = 0; i < date.Stars; i++) { Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/StarIcon")).transform.SetParent(Stars.transform); } }
public static Sprite GetSprite(string name) { return(_spriteAtlas.GetSprite(name)); }
void Start() { gameObject.GetComponent <SpriteRenderer>().sprite = UISpriteAtlas.GetSprite("impassable_mark"); }
public void ChangeSprite() { b = vl [pos]; myRenderer.sprite = atlas.GetSprite(b); }
void Start() { gameObject.GetComponent <Image>().sprite = UISpriteAtlas.GetSprite("white ogre"); }
public void ChangeSprite(SpriteAtlas atlas) { img.sprite = atlas.GetSprite("4"); Debug.Log("11111"); }
private void CheckWater() { foreach (KeyValuePair <Point, GameObject> tile in waterTiles) { string composition = TileCheck(tile.Key); if (composition[1] == 'G' && composition[3] == 'W' && composition[4] == 'G' && composition[6] == 'W') { tile.Value.GetComponent <SpriteRenderer>().sprite = waterAtlas.GetSprite("0"); } if (composition[1] == 'W' && composition[3] == 'W' && composition[4] == 'G' && composition[6] == 'W') { tile.Value.GetComponent <SpriteRenderer>().sprite = waterAtlas.GetSprite("1"); } if (composition[1] == 'W' && composition[3] == 'W' && composition[4] == 'G' && composition[6] == 'G') { tile.Value.GetComponent <SpriteRenderer>().sprite = waterAtlas.GetSprite("2"); } if (composition[1] == 'G' && composition[3] == 'W' && composition[4] == 'W' && composition[6] == 'W') { tile.Value.GetComponent <SpriteRenderer>().sprite = waterAtlas.GetSprite("3"); } if (composition[1] == 'W' && composition[3] == 'W' && composition[4] == 'W' && composition[6] == 'G') { tile.Value.GetComponent <SpriteRenderer>().sprite = waterAtlas.GetSprite("4"); } if (composition[1] == 'G' && composition[3] == 'G' && composition[4] == 'W' && composition[6] == 'W') { tile.Value.GetComponent <SpriteRenderer>().sprite = waterAtlas.GetSprite("5"); } if (composition[1] == 'W' && composition[4] == 'W' && composition[3] == 'G' && composition[6] == 'W') { tile.Value.GetComponent <SpriteRenderer>().sprite = waterAtlas.GetSprite("6"); } if (composition[1] == 'W' && composition[3] == 'G' && composition[4] == 'W' && composition[6] == 'G') { tile.Value.GetComponent <SpriteRenderer>().sprite = waterAtlas.GetSprite("7"); } if (composition[1] == 'W' && composition[3] == 'G' && composition[4] == 'G' && composition[6] == 'G') { tile.Value.GetComponent <SpriteRenderer>().sprite = waterAtlas.GetSprite("8"); } if (composition[1] == 'G' && composition[3] == 'G' && composition[4] == 'G' && composition[6] == 'W') { tile.Value.GetComponent <SpriteRenderer>().sprite = waterAtlas.GetSprite("9"); } if (composition[1] == 'W' && composition[3] == 'G' && composition[4] == 'G' && composition[6] == 'W') { tile.Value.GetComponent <SpriteRenderer>().sprite = waterAtlas.GetSprite("10"); } if (composition[1] == 'G' && composition[3] == 'W' && composition[4] == 'W' && composition[6] == 'G') { tile.Value.GetComponent <SpriteRenderer>().sprite = waterAtlas.GetSprite("11"); } if (composition[1] == 'G' && composition[3] == 'G' && composition[4] == 'W' && composition[6] == 'G') { tile.Value.GetComponent <SpriteRenderer>().sprite = waterAtlas.GetSprite("12"); } if (composition[1] == 'G' && composition[3] == 'W' && composition[4] == 'G' && composition[6] == 'G') { tile.Value.GetComponent <SpriteRenderer>().sprite = waterAtlas.GetSprite("13"); } if (composition[3] == 'W' && composition[5] == 'G' && composition[6] == 'W') { GameObject go = Instantiate(tile.Value, tile.Value.transform.position, Quaternion.identity, map); go.GetComponent <SpriteRenderer>().sprite = waterAtlas.GetSprite("14"); go.GetComponent <SpriteRenderer>().sortingOrder = 1; } if (composition[1] == 'W' && composition[2] == 'G' && composition[4] == 'W') { GameObject go = Instantiate(tile.Value, tile.Value.transform.position, Quaternion.identity, map); go.GetComponent <SpriteRenderer>().sprite = waterAtlas.GetSprite("15"); go.GetComponent <SpriteRenderer>().sortingOrder = 1; } if (composition[4] == 'W' && composition[6] == 'W' && composition[7] == 'G') { GameObject go = Instantiate(tile.Value, tile.Value.transform.position, Quaternion.identity, map); go.GetComponent <SpriteRenderer>().sprite = waterAtlas.GetSprite("16"); go.GetComponent <SpriteRenderer>().sortingOrder = 1; } if (composition[0] == 'G' && composition[1] == 'W' && composition[3] == 'W') { GameObject go = Instantiate(tile.Value, tile.Value.transform.position, Quaternion.identity, map); go.GetComponent <SpriteRenderer>().sprite = waterAtlas.GetSprite("17"); go.GetComponent <SpriteRenderer>().sortingOrder = 1; } if (composition[1] == 'W' && composition[3] == 'W' && composition[4] == 'W' && composition[6] == 'W') { int randomTile = UnityEngine.Random.Range(0, 100); if (randomTile < 15) { tile.Value.GetComponent <SpriteRenderer>().sprite = waterAtlas.GetSprite("19"); } } if (composition[1] == 'W' && composition[2] == 'W' && composition[3] == 'W' && composition[4] == 'W' && composition[5] == 'W' && composition[6] == 'W') { int randomTile = UnityEngine.Random.Range(0, 100); if (randomTile < 10) { tile.Value.GetComponent <SpriteRenderer>().sprite = waterAtlas.GetSprite("20"); } } } }
void Start() { gameObject.GetComponent <Image>().sprite = UISpriteAtlas.GetSprite("bridge3"); }
void Start() { GetComponent <SpriteRenderer>().sprite = atlas.GetSprite(levelname); InitStones(); }
public Sprite LoadSprite(string spriteName) { return(EmojiAtlas.GetSprite(spriteName)); }
void Start() { gameObject.GetComponent <Image>().sprite = UISpriteAtlas.GetSprite("TutorialButton"); }