private void LoadOriginImg() { //加载原图 X.Res.LevelConfig levelConfig = LevelMgr.GetInstance().GetLevelConfig(levelID).Config; Debug.Log("levelID:" + levelID); int pitcureId = levelConfig.LevelPicture; string altasname = AltasMgr.GetInstance().GetConfigByID((uint)pitcureId).AltasName2; Debug.Log(altasname); UIAtlas ats = UIAtlasUtil.GetAtlas(altasname); ats.Sp = originImg; ats.SetSprite("p_" + levelConfig.LevelPicture.ToString()); }
private void LoadOriginImg() { //加载原图 Image img = gameObject.transform.Find("GameObject").transform.Find("Image").GetComponent <Image>(); int pitcureId = LevelMgr.GetInstance().GetLevelConfig(levelID).Config.LevelPicture; string altasname = AltasMgr.GetInstance().GetConfigByID((uint)pitcureId).AltasName2; Debug.Log(altasname); UIAtlas ats = UIAtlasUtil.GetAtlas(altasname); ats.Sp = img; ats.SetSprite("p_" + data.Config.LevelPicture.ToString()); //加载关卡名字 //menuText.text = LevelMgr.GetInstance().GetIndexByID(levelID); }
private void ModiMapAndInfo() { updateFlag = false; //修改图片和信息的显示 //获得表 int dayId = TimeUtil.getIntByDateTime(m_selectedDateTime); SignInConfig signInConfig = SignInMgr.GetInstance().GetConfigByID((uint)dayId); m_selectedLevelID = signInConfig.LevelId; LevelData levelData = LevelMgr.GetInstance().GetLevelConfig(m_selectedLevelID); LevelConfig levelConfig = levelData.Config; if (levelConfig == null) { Debug.LogError("获取不到关卡 " + m_selectedLevelID + " 的Config"); return; } //TODO:修改mapIcon的图标,需要通过读表获取对应的图集 AltasConfig altasConfig = AltasMgr.GetInstance().GetConfigByID(m_selectedLevelID); string altasname = altasConfig.AltasName2; UIAtlas ats = UIAtlasUtil.GetAtlas(altasname); if (ats != null) { ats.Sp = mapIcon; if (SignInMgr.GetInstance().IsSign(dayId - GameConfig.SignInDay)) { ats.SetSprite("p_" + levelConfig.LevelPicture.ToString()); } else { ats.SetSprite("s_" + levelConfig.LevelPicture.ToString()); } } //TODO:修改info,包括了编号、名字、剩余时间和按钮的状态、文字等 levelNumText.text = "#" + (SignInMgr.GetInstance().GetIndexByID((uint)dayId) + 1).ToString(); LanguageMgr.GetInstance().GetLangStrByID(levelNameText, signInConfig.DailylevelName); StartCoroutine(TimeLeftUpdate(m_selectedDateTime.AddDays(1))); ModiTryButton(); }
private void LoadLevelBtn(UILevelBtn uiLevelBtn, uint id, string picture, int levelCnt, int themeCnt) { //加载关卡名字,缩略图; //uiLevelBtn.levelText.text = themeCnt.ToString() + "-" + (levelCnt + 1).ToString(); //string picname = "level_s";//string.Format("s_{0}", picture); string altasname = AltasMgr.GetInstance().GetConfigByID(id).AltasName; UIAtlas ats = UIAtlasUtil.GetAtlas(altasname); UIAtlas ats2 = UIAtlasUtil.GetAtlas("uncomplete"); ats.Sp = uiLevelBtn.levelImg; ats2.Sp = uiLevelBtn.levelImg; if (ats != null) { if (XPlayerPrefs.GetInt(id.ToString() + isCompleted) == 1) { ats.SetSprite("s_" + picture);//ats.SetSprite("p_"+picture); ats.Sp.rectTransform.localScale = Vector3.one; uiLevelBtn.star.SetActive(true); uiLevelBtn._new.SetActive(false); //uiLevelBtn.levelText.text = LevelMgr.GetInstance().GetLevelConfig(id).Config.LevelName; //uiLevelBtn.levelText.text = themeCnt.ToString() + "-" + (levelCnt + 1).ToString(); } else if (XPlayerPrefs.GetInt(id.ToString() + isUnlock) == -1) { //Debug.Log("isunlock"); ats2.SetSprite("unknown"); ats.Sp.rectTransform.localScale = new Vector3(0.8f, 0.8f, 0.8f); uiLevelBtn._new.SetActive(true); uiLevelBtn.star.SetActive(false); //uiLevelBtn.levelText.text = (levelCnt+1).ToString(); //uiLevelBtn.levelText.text = "? ? ?"; } else { uiLevelBtn.star.SetActive(false); uiLevelBtn._new.SetActive(false); uiLevelBtn.SetGray(); //Debug.Log("islock"); //未解锁 ats2.SetSprite("lock"); ats.Sp.rectTransform.localScale = new Vector3(0.8f, 0.8f, 0.8f); } } #region starandlock ////加载星星 //if (UnpackStarNum(XPlayerPrefs.GetInt(id.ToString() + numStar)) >= 1) //{ // int stars = UnpackStarNum(XPlayerPrefs.GetInt(id.ToString() + numStar)); // Debug.Log(stars); // for (int i = 0; i < 3; i++) // { // UIAtlas starAts = ResMgr.GetAtlas("levelStar"); // starAts.Sp = uiLevelBtn.stars[i]; // if (i < stars) // { // starAts.SetSprite("guanqiaxuanzexing1"); // } // else // { // starAts.SetSprite("guanqiaxuanzexing2"); // } // } //} //else //{ // for (int i = 0; i < 3; i++) // { // uiLevelBtn.stars[i].color = new Color(255, 255, 255, 0); // } //} ////设置解锁状态; //UIAtlas unlockAts = ResMgr.GetAtlas("unlock"); //unlockAts.Sp = uiLevelBtn.unlockBtn; //switch (LevelMgr.GetInstance().GetLevelConfig(id).Config.LevelUnlock) //{ // case 0: // XPlayerPrefs.SetInt(id.ToString() + isUnlock, -1); // Destroy(uiLevelBtn.unlockBtn.gameObject); // break; // case 1: // if(XPlayerPrefs.GetInt(id.ToString()+isUnlock)==-1) // { // Destroy(uiLevelBtn.unlockBtn.gameObject); // break; // } // XPlayerPrefs.SetInt(id.ToString() + isUnlock, 1); // unlockAts.SetSprite("guanggao"); // break; // case 2: // if (XPlayerPrefs.GetInt(id.ToString() + isUnlock) == -1) // { // Destroy(uiLevelBtn.unlockBtn.gameObject); // break; // } // XPlayerPrefs.SetInt(id.ToString() + isUnlock, 2); // unlockAts.SetSprite("zuanshi"); // break; //} #endregion }