Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- root/introloading.py
- """
- ## Search:
- self.loadingGage=self.GetChild("FullGage")
- ## Add:
- self.loadingTip=self.GetChild("LoadingTip")
- ## Search:
- width = float(wndMgr.GetScreenWidth()) / float(self.loadingImage.GetWidth())
- ## Before add:
- tipTexts = pack_open(uiScriptLocale.tipList, "r").readlines()
- tipID = app.GetRandom(1,len(tipTexts))
- for i in xrange(len(tipTexts)):
- lines = str(tipTexts)
- if lines == "\n" or lines == "":
- continue
- tokens = lines.split("\t")
- tipID_inFile, tipText_inFile = int(tokens[0]), str(tokens[1])
- if tipID == tipID_inFile:
- self.loadingTip.SetText(tipText_inFile)
- """
- root/uiscriptlocale.py
- """
- ## Search:
- LoadLocaleFile(LOCALE_INTERFACE_FILE_NAME, locals())
- ## Add:
- tipList = "%s/loading_tips.txt" % (name)
- """
- root/ui.py
- """
- ## Search:
- class ThinBoard(Window):
- ## Before add:
- class MiddleBoard(Window):
- CORNER_WIDTH = 16
- CORNER_HEIGHT = 16
- LINE_WIDTH = 16
- LINE_HEIGHT = 16
- BOARD_COLOR = grp.GenerateColor(0.0, 0.0, 0.0, 0.51)
- LT = 0
- LB = 1
- RT = 2
- RB = 3
- L = 0
- R = 1
- T = 2
- B = 3
- def __init__(self, layer = "UI"):
- Window.__init__(self, layer)
- CornerFileNames = [ "d:/ymir work/ui/pattern/ThinBoard_Corner_"+dir+".tga" for dir in ["LeftTop","LeftBottom","RightTop","RightBottom"] ]
- LineFileNames = [ "d:/ymir work/ui/pattern/ThinBoard_Line_"+dir+".tga" for dir in ["Left","Right","Top","Bottom"] ]
- self.Corners = []
- for fileName in CornerFileNames:
- Corner = ExpandedImageBox()
- Corner.AddFlag("attach")
- Corner.AddFlag("not_pick")
- Corner.LoadImage(fileName)
- Corner.SetParent(self)
- Corner.SetPosition(0, 0)
- Corner.Show()
- self.Corners.append(Corner)
- self.Lines = []
- for fileName in LineFileNames:
- Line = ExpandedImageBox()
- Line.AddFlag("attach")
- Line.AddFlag("not_pick")
- Line.LoadImage(fileName)
- Line.SetParent(self)
- Line.SetPosition(0, 0)
- Line.Show()
- self.Lines.append(Line)
- Base = Bar()
- Base.SetParent(self)
- Base.AddFlag("attach")
- Base.AddFlag("not_pick")
- Base.SetPosition(self.CORNER_WIDTH, self.CORNER_HEIGHT)
- Base.SetColor(self.BOARD_COLOR)
- Base.Show()
- self.Base = Base
- self.Lines[self.L].SetPosition(0, self.CORNER_HEIGHT)
- self.Lines[self.T].SetPosition(self.CORNER_WIDTH, 0)
- def __del__(self):
- Window.__del__(self)
- def SetSize(self, width, height):
- width = max(self.CORNER_WIDTH*2, width)
- height = max(self.CORNER_HEIGHT*2, height)
- Window.SetSize(self, width, height)
- self.Corners[self.LB].SetPosition(0, height - self.CORNER_HEIGHT)
- self.Corners[self.RT].SetPosition(width - self.CORNER_WIDTH, 0)
- self.Corners[self.RB].SetPosition(width - self.CORNER_WIDTH, height - self.CORNER_HEIGHT)
- self.Lines[self.R].SetPosition(width - self.CORNER_WIDTH, self.CORNER_HEIGHT)
- self.Lines[self.B].SetPosition(self.CORNER_HEIGHT, height - self.CORNER_HEIGHT)
- verticalShowingPercentage = float((height - self.CORNER_HEIGHT*2) - self.LINE_HEIGHT) / self.LINE_HEIGHT
- horizontalShowingPercentage = float((width - self.CORNER_WIDTH*2) - self.LINE_WIDTH) / self.LINE_WIDTH
- self.Lines[self.L].SetRenderingRect(0, 0, 0, verticalShowingPercentage)
- self.Lines[self.R].SetRenderingRect(0, 0, 0, verticalShowingPercentage)
- self.Lines[self.T].SetRenderingRect(0, 0, horizontalShowingPercentage, 0)
- self.Lines[self.B].SetRenderingRect(0, 0, horizontalShowingPercentage, 0)
- self.Base.SetSize(width - self.CORNER_WIDTH*2, height - self.CORNER_HEIGHT*2)
- def ShowInternal(self):
- self.Base.Show()
- for wnd in self.Lines:
- wnd.Show()
- for wnd in self.Corners:
- wnd.Show()
- def HideInternal(self):
- self.Base.Hide()
- for wnd in self.Lines:
- wnd.Hide()
- for wnd in self.Corners:
- wnd.Hide()
- ## Search:
- elif Type == "thinboard":
- parent.Children[Index] = ThinBoard()
- parent.Children[Index].SetParent(parent)
- self.LoadElementThinBoard(parent.Children[Index], ElementValue, parent)
- ## Before add:
- elif Type == "middleboard":
- parent.Children[Index] = MiddleBoard()
- parent.Children[Index].SetParent(parent)
- self.LoadElementMiddleBoard(parent.Children[Index], ElementValue, parent)
- ## Search:
- ## ThinBoard
- def LoadElementThinBoard(self, window, value, parentWindow):
- ## Before add:
- ## MiddleBoard
- def LoadElementMiddleBoard(self, window, value, parentWindow):
- if FALSE == self.CheckKeyList(value["name"], value, self.BOARD_KEY_LIST):
- return FALSE
- window.SetSize(int(value["width"]), int(value["height"]))
- self.LoadDefaultData(window, value, parentWindow)
- return TRUE
- """
- locale/xx/ui/loadingwindow.py
- """
- ## Search:
- ## Board
- {
- "name" : "BackGround",
- "type" : "expanded_image",
- "x" : 0,
- "y" : 0,
- "image" : "d:/ymir work/ui/intro/pattern/Line_Pattern.tga",
- "x_scale" : float(SCREEN_WIDTH) / 800.0,
- "y_scale" : float(SCREEN_HEIGHT) / 600.0,
- },
- ## Before add:
- {
- "name" : "TipBackground",
- "type" : "middleboard",
- "x" : 0,
- "y" : float(SCREEN_HEIGHT) * 500 / 600.0 - 100,
- "width" : SCREEN_WIDTH,
- "height" : 100,
- "children" :
- (
- {
- "name" : "LoadingTip",
- "type" : "text",
- "x" : float(SCREEN_WIDTH) / 2,
- "y" : 40,
- "fontsize" : "LARGE",
- "text_horizontal_align" : "center",
- },
- ),
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement