public void initData() { using (var stream = new MemoryStream(storyRel.bytes)) { StoryRelationTab._instance().Load(stream); } using (var stream = new MemoryStream(storyBgSceneRel.bytes)) { StoryBgSceneRelationTab._instance().Load(stream); } using (var stream = new MemoryStream(bgScenePic.bytes)) { bgScenePicTab._instance().Load(stream); } using (var stream = new MemoryStream(roleFacePic.bytes)) { roleFacePicTab._instance().Load(stream); } using (var stream = new MemoryStream(talkOption.bytes)) { talkOptionTab._instance().Load(stream); } }
public static StoryBgSceneRelationTab _instance() { if (instance == null) { instance = new StoryBgSceneRelationTab(); instance.initParam(); } return(instance); }
//切换背景的场景 private void showBgScene(int lid) { //获得场景图片的ID int bgPicID = StoryBgSceneRelationTab._instance().GetKeyValueFromID <int, int> (StoryBgSceneRelationTab.csStoryID, lid, StoryBgSceneRelationTab.csSceneID, 0); string bgPicName = bgScenePicTab._instance().GetValueFromID <string>(bgPicID, bgScenePicTab.csScenePic, ""); if (bgPicName == "") { Debug.LogError("bgPicName is null, storyid is" + lid.ToString()); } string picPathName = csBgPicPath + bgPicName; //不含png扩展名 // string picPathName = csBgPicPath + "boar_blue.png"; Texture2D tmpPic = (Texture2D)Resources.Load(picPathName) as Texture2D; sceneImage.sprite = Sprite.Create(tmpPic, new Rect(0, 0, tmpPic.width, tmpPic.height), new Vector2(0.5f, 0.5f)); }