public virtual void parseData(int tempID) { storyDict.Clear(); templateID = tempID; int startID = StaticDialog.Instance().getInt(templateID, "starid"); int endID = StaticDialog.Instance().getInt(templateID, "endid"); for(int i = startID; i <= endID; i++) { string res = StaticSentence.Instance().getStr(i, "res"); int pos = StaticSentence.Instance().getInt(i, "pos"); int fx = StaticSentence.Instance().getInt(i, "fx"); string des = StaticSentence.Instance().getStr(i, "detail"); StroyStruct stroy = new StroyStruct(); stroy.heroPic = res; stroy.pos = pos; stroy.fx = fx; stroy.des = des; storyDict.Add(i - startID, stroy); } }
public void addNewRightHero(StroyStruct nextData) { int tempRightIdx = curRightIdx; if(tempRightIdx >= RightHero.Length-1) { tempRightIdx = 0; } UISprite new_sp = Instantiate(RightHero[curRightIdx]) as UISprite; new_sp.transform.parent = screenPanel.transform; new_sp.transform.localScale = Vector3.one; new_sp.transform.localPosition = Vector3.zero; new_sp.spriteName = nextData.heroPic; RightHero[++tempRightIdx] = new_sp; //pos Vector3 right_out = RightHero[tempRightIdx].transform.localPosition; right_out.x = screenPanel.width/2 + RightHero[tempRightIdx].width; float h = heroPicY;//(screenPanel.height/2 - RightHero[tempRightIdx].height/2); right_out.y = heroPicY;//h > 0 ? -1*h : h; RightHero[tempRightIdx].transform.localPosition = right_out; //oldPic goback Vector3 pos = RightHero[curRightIdx].transform.localPosition; pos.x = RightHero[curRightIdx].width/2 + screenPanel.width; TweenPosition.Begin(RightHero[curRightIdx].gameObject, gobackTime, pos); curRightIdx = tempRightIdx; //newPic goFront pos = RightHero[curRightIdx].transform.localPosition; pos.x = goFrontPos; TweenPosition.Begin(RightHero[curRightIdx].gameObject, gobackTime, pos); }