Exemplo n.º 1
0
def BuyItem_ByID(ItemID):
    global SelectedItemLevel
    global LastClickedItem
    global SelectedItemPrice
    global SelectedItemID
    Price = gameItems.GetItemUpgradePrice_ByID(ItemID)

    print("BuyItemUpgrade : ItemID[{0}] Price[{1}]".format(
        str(ItemID), str(Price)))

    if save.Current_Experience >= Price:
        save.Current_Experience -= Price
        IncomingLog.AddMessageText(
            gameMain.DefaultCnt.Get_RegKey(
                "/strings/window/expecience_store/item_upgrade"), False,
            (140, 240, 140))

        # -- Write item level Information -- #
        gameItems.IncreaseItemLevel_ByID(ItemID)

        ReloadItemsList()
    else:
        sound.PlaySound("/hit_2.wav", 0.5)
Exemplo n.º 2
0
def Update():
    global DownBar_BuyPanelYOffset
    global DownBar_BuyPanelAnimEnabled
    global DownBar_BuyPanelYOffsetAdder

    # -- Set the Buy Button Location -- #
    BuyButton.Set_X(WindowObject.WindowRectangle[2] - BuyButton.Rectangle[2] -
                    5)
    BuyButton.Set_Y(WindowObject.WindowRectangle[3] - BuyButton.Rectangle[3] -
                    DownBar_BuyPanelYOffset + 5)
    # -- Set the Buy Button Collision -- #
    BuyButton.Set_ColisionX(WindowObject.WindowRectangle[0] +
                            BuyButton.Rectangle[0])
    BuyButton.Set_ColisionY(WindowObject.WindowRectangle[1] +
                            BuyButton.Rectangle[1] + BuyButton.Rectangle[3])

    if BuyButton.ButtonState == 2:
        BuyButton.ButtonState = "INATIVE"
        if save.Current_Experience >= gameItems.GetItemUpgradePrice_ByID(
                SelectedItemID):
            BuyItem_ByID(SelectedItemID)

    # -- Set Items List Size -- #
    ListItems.Set_W(DrawnSurface.get_width())
    ListItems.Set_H(DrawnSurface.get_height())
    ListItems.ColisionXOffset = WindowObject.WindowRectangle[0]
    ListItems.ColisionYOffset = WindowObject.WindowRectangle[1] + 20

    # -- Buy Panel -- #
    if DownBar_BuyPanelAnimEnabled:
        DownBar_BuyPanelYOffsetAdder += 1
        DownBar_BuyPanelYOffset += DownBar_BuyPanelYOffsetAdder

        if DownBar_BuyPanelYOffset >= 30:
            DownBar_BuyPanelYOffset = 30
            DownBar_BuyPanelAnimEnabled = False
            DownBar_BuyPanelYOffsetAdder = 0
Exemplo n.º 3
0
def Render(DISPLAY):
    global WindowObject
    global DrawnSurface
    global BuyButton
    global ListItems
    global DownBar_BuyPanelAnimEnabled
    global DownBar_BuyPanelYOffset
    global LastClickedItem
    global SelectedItemID
    global SelectedItemPrice
    global SelectedItemLevel
    global StoreLocked
    # -- Update the Surface -- #
    DrawnSurface = pygame.Surface((WindowObject.WindowSurface_Rect[2],
                                   WindowObject.WindowSurface_Rect[3]),
                                  pygame.SRCALPHA)

    if not StoreLocked:
        # -- Draw the List -- #
        ListItems.Render(DrawnSurface)

        # -- Render the Selected Item Text -- #
        if ListItems.LastItemClicked != "null":
            if LastClickedItem != ListItems.LastItemClicked:
                DownBar_BuyPanelAnimEnabled = True
                DownBar_BuyPanelYOffset = 0
            LastClickedItem = ListItems.LastItemClicked

            # -- Set Item Price and ID -- #
            SelectedItemID = ListItems.LastItemOrderID - 1
            SelectedItemLevel = gameItems.GetItemLevel_ByID(SelectedItemID) + 1
            SelectedItemPrice = gameItems.GetItemUpgradePrice_ByID(
                SelectedItemID)

            # -- Down Panel Background -- #
            CONTENT_MANAGER.Shape_Rectangle(
                DrawnSurface, (0, 0, 0, 100),
                (0, DrawnSurface.get_height() - DownBar_BuyPanelYOffset,
                 DrawnSurface.get_width(), DownBar_BuyPanelYOffset))
            CONTENT_MANAGER.Shape_Rectangle(
                DrawnSurface, (16, 166, 152),
                (0, DrawnSurface.get_height() - DownBar_BuyPanelYOffset - 1,
                 DrawnSurface.get_width(), 1))

            # -- Draw the Buy Button -- #
            BuyButton.Render(DrawnSurface)

            # -- Draw the Item Title -- #
            CONTENT_MANAGER.FontRender(
                DrawnSurface, "/PressStart2P.ttf", 15,
                ListItems.LastItemClicked, (250, 250, 250), 10,
                DrawnSurface.get_height() - DownBar_BuyPanelYOffset + 5,
                gameMain.DefaultCnt.Get_RegKey("/OPTIONS/font_aa"))

            # -- Draw the Item Price -- #
            PriceTextOpacity = 255
            if save.Current_Experience < SelectedItemPrice:
                PriceTextOpacity = 100 - abs(save.Current_Experience -
                                             SelectedItemPrice)

                if PriceTextOpacity <= 100:
                    PriceTextOpacity = 100

            CONTENT_MANAGER.FontRender(
                DrawnSurface,
                "/PressStart2P.ttf",
                8,
                "€xp" + str(utils.FormatNumber(SelectedItemPrice)),
                (PriceTextOpacity, PriceTextOpacity, PriceTextOpacity),
                10,
                DrawnSurface.get_height() - DownBar_BuyPanelYOffset + 20,
                gameMain.DefaultCnt.Get_RegKey("/OPTIONS/font_aa"),
                Opacity=PriceTextOpacity)

    WindowObject.Render(DISPLAY)  # -- Render Window Border
    DISPLAY.blit(
        DrawnSurface,
        (WindowObject.WindowSurface_Rect[0],
         WindowObject.WindowSurface_Rect[1]))  # -- Render Window Objects