Exemplo n.º 1
0
def WindowsUpdate():
    if StoreWindow_Enabled:
        storeWindow.Update()

    elif ExperienceStore_Enabled:
        expStoreWindow.Update()

    elif InfosWindow_Enabled:
        infosWindow.Update()
Exemplo n.º 2
0
def Initialize(DISPLAY):
    # -- Set Buttons -- #
    global SaveButton
    global GameOptionsButton
    global GrindButton
    global BackToMainMenuButton
    global OpenStoreButton
    global ItemsView
    global OpenInfosWindowButton
    global OpenExperienceWindowButton
    global HUD_Surface

    # -- Initialize Buttons -- #
    GrindButton = gameObjs.Button(pygame.rect.Rect(15, 115, 130, 150), "Lorem",
                                  18)
    GrindButton.WhiteButton = True
    GameOptionsButton = gameObjs.Button(
        pygame.rect.Rect(DISPLAY.get_width() - 120, 5, 0, 0),
        gameMain.DefaultCnt.Get_RegKey("/strings/button/game/options"), 12)
    SaveButton = gameObjs.Button(
        pygame.rect.Rect(DISPLAY.get_width() - 120, 20, 0, 0),
        gameMain.DefaultCnt.Get_RegKey("/strings/button/game/save"), 12)
    BackToMainMenuButton = gameObjs.Button(
        pygame.Rect(DISPLAY.get_width() - 120, 35, 0, 0),
        gameMain.DefaultCnt.Get_RegKey("/strings/button/game/main_menu"), 12)
    OpenStoreButton = gameObjs.Button(
        pygame.Rect(5,
                    DISPLAY.get_height() - 25, 0, 0),
        gameMain.DefaultCnt.Get_RegKey("/strings/button/game/store"), 14)
    OpenInfosWindowButton = gameObjs.Button(
        pygame.Rect(0, 0, 0, 0),
        gameMain.DefaultCnt.Get_RegKey("/strings/button/game/infos"), 14)
    OpenExperienceWindowButton = gameObjs.Button(
        pygame.Rect(0, 0, 0, 0),
        gameMain.DefaultCnt.Get_RegKey(
            "/strings/button/game/experience_store"), 14)
    ItemsView = gameObjs.GameItemsView(pygame.Rect(5, 500, 430, 100))

    IncomingLog.Initialize()

    # -- Initialize Objects -- #
    storeWindow.Initialize()
    expStoreWindow.Initialize()
    infosWindow.Initialize()
    gameMain.ClearColor = (5, 20, 14)

    # -- Initialize the Screen -- #
    HUD_Surface = pygame.Surface((DISPLAY.get_width(), DISPLAY.get_height()))

    #    # -- Load the Save Game -- #
    LoadGame()
Exemplo n.º 3
0
def EventUpdate(event):
    # -- Update all buttons -- #
    global GrindButton
    global GameOptionsButton
    global SaveButton
    global BackToMainMenuButton
    global OpenStoreButton
    global StoreWindow_Enabled
    global ItemsView
    global IsControlsEnabled
    global OpenExperienceWindowButton
    global OpenInfosWindowButton
    global BlinkExperienceEnabled
    global HUD_Surface

    if IsControlsEnabled:
        GrindButton.Update(event)
        GameOptionsButton.Update(event)
        SaveButton.Update(event)
        BackToMainMenuButton.Update(event)
        OpenStoreButton.Update(event)
        ItemsView.Update(event)
        IncomingLog.EventUpdate(event)
        OpenInfosWindowButton.Update(event)

        if gameItems.GetItemCount_ByID(-1) == 1:
            OpenExperienceWindowButton.Update(event)

        # -- Update store Window -- #
        if StoreWindow_Enabled:
            storeWindow.EventUpdate(event)

        # -- Update Infos Window -- #
        if InfosWindow_Enabled:
            infosWindow.EventUpdate(event)

        if ExperienceStore_Enabled:
            expStoreWindow.EventUpdate(event)

    if event.type == pygame.KEYUP and event.key == pygame.K_z:
        save.GrindClick()

    if event.type == pygame.KEYUP and event.key == pygame.K_m:
        save.GrindClick()
Exemplo n.º 4
0
def LoadSaveData():
    global CurrentDate_Day
    global CurrentDate_Month
    global CurrentDate_Year
    global CurrentDate_Minute
    global CurrentDate_Second
    global CurrentDate_Microseconds
    global Current_TotalClicks
    global Current_TotalClicksNext
    global Current_TotalClicksForEach
    global Current_ExperiencePerEach
    global Current_MoneyPerClickBest
    global Current_Experience
    global Current_Money
    global Current_MoneyValuePerClick
    global CurrentDate_DayLimiter
    global CurrentDate_MonthLimiter
    global CurrentDate_MinuteLimiter
    global CurrentDate_SecondLimiter
    global CurrentDate_YearLimiter
    global Current_MoneyMinimun
    global SaveDataLoaded
    global triggered_tutorials
    global WelcomeMessageTriggered
    global LowerMoneyWarning
    global PlanetID
    global PlanetName

    print("Fogoso.SaveManager : Loading Save Data...")

    # -- Load Money and Click Variables -- #
    Current_Money = appData.ReadAppData_WithTry("money", float, 0.0)
    Current_MoneyValuePerClick = appData.ReadAppData_WithTry(
        "money_per_click", float, 0.50)
    Current_MoneyMinimun = appData.ReadAppData_WithTry("money_minimun", float,
                                                       -5000)
    Current_Experience = appData.ReadAppData_WithTry("experience", int, 0)
    Current_TotalClicks = appData.ReadAppData_WithTry("total_clicks", int, 0)
    Current_TotalClicksForEach = appData.ReadAppData_WithTry(
        "total_clicks_for_each", int, 35)
    Current_ExperiencePerEach = appData.ReadAppData_WithTry(
        "total_experience_per_each", int, 15)
    Current_MoneyPerClickBest = appData.ReadAppData_WithTry(
        "click_last_best", float, 0)

    # -- Calculate the Total Clicks Next -- #
    Current_TotalClicksNext = Current_TotalClicks + Current_TotalClicksForEach

    # -- Load the Current Date -- #
    CurrentDate_Year = appData.ReadAppData_WithTry("date/year", int, 0)
    CurrentDate_Month = appData.ReadAppData_WithTry("date/month", int, 0)
    CurrentDate_Day = appData.ReadAppData_WithTry("date/day", int, 0)
    CurrentDate_Second = appData.ReadAppData_WithTry("date/second", int, 0)
    CurrentDate_Minute = appData.ReadAppData_WithTry("date/minute", int, 0)
    CurrentDate_Microseconds = appData.ReadAppData_WithTry(
        "date/microsecond", int, 0)

    # -- Load the Date Limiters -- #
    CurrentDate_MinuteLimiter = appData.ReadAppData_WithTry(
        "date/limiter/minute", int, 60)
    CurrentDate_SecondLimiter = appData.ReadAppData_WithTry(
        "date/limiter/second", int, 50)
    CurrentDate_DayLimiter = appData.ReadAppData_WithTry(
        "date/limiter/day", int, 5)
    CurrentDate_MonthLimiter = appData.ReadAppData_WithTry(
        "date/limiter/month", int, 7)
    CurrentDate_YearLimiter = appData.ReadAppData_WithTry(
        "date/limiter/year", int, 5)

    # -- Load Last Maintenance -- #
    maintenance.DayTrigger = appData.ReadAppData_WithTry(
        "maintenance_day_trigger", int, 1)
    maintenance.PerDayValue = appData.ReadAppData_WithTry(
        "maintenance_per_day_value", int, 1)
    maintenance.BaseMaintenance = appData.ReadAppData_WithTry(
        "maintenance_base_price", float, 15.0)

    # -- ETC -- #
    WelcomeMessageTriggered = appData.ReadAppData_WithTry(
        "welcome_message_triggered", bool, False)
    LowerMoneyWarning = appData.ReadAppData_WithTry("lower_money_warning",
                                                    bool, False)

    # -- Load Passed Tutorials -- #
    try:
        FileData = appData.ReadAppData_WithTry("tutorials_triggered", str, "")
        SplitedData = FileData.split('%n')
        for tutorial in SplitedData:
            try:
                Index = triggered_tutorials.index(str(tutorial))

            except ValueError:
                triggered_tutorials.append(str(tutorial))
    except AttributeError:
        appData.WriteAppData("tutorials_triggered", "")

    gameItems.LoadItems()
    print("Fogoso.SaveManager : Loading Store Items...")

    storeWindow.ReloadItemsList()
    expStoreWindow.ReloadItemsList()

    # -- Load the Planet Data -- #
    PlanetName = appData.ReadAppData_WithTry("planet_name", str, "Aragubas")
    PlanetID = appData.ReadAppData_WithTry("planet_id", int, 0)

    planets.LoadPlanetsData()

    print("Fogoso.SaveManager : Operation Completed!")
    SaveDataLoaded = True
Exemplo n.º 5
0
def Unload():
    global CurrentDate_Day
    global CurrentDate_Month
    global CurrentDate_Year
    global CurrentDate_Minute
    global CurrentDate_Second
    global CurrentDate_Microseconds
    global Current_TotalClicks
    global Current_TotalClicksNext
    global Current_TotalClicksForEach
    global Current_ExperiencePerEach
    global Current_MoneyPerClickBest
    global Current_Experience
    global Current_Money
    global Current_MoneyValuePerClick
    global CurrentDate_DayLimiter
    global CurrentDate_MonthLimiter
    global CurrentDate_MinuteLimiter
    global CurrentDate_SecondLimiter
    global CurrentDate_YearLimiter
    global Current_MoneyMinimun
    global SaveDataLoaded
    global triggered_tutorials
    global WelcomeMessageTriggered
    global LowerMoneyWarning
    global BankruptWarning
    global PlanetID
    global PlanetName

    CurrentDate_Day = None
    CurrentDate_Month = None
    CurrentDate_Year = None
    CurrentDate_Minute = None
    CurrentDate_Second = None
    CurrentDate_Microseconds = None
    Current_TotalClicks = None
    Current_TotalClicksNext = None
    Current_TotalClicksForEach = None
    Current_ExperiencePerEach = None
    Current_MoneyPerClickBest = None
    Current_Experience = None
    Current_Money = None
    Current_MoneyValuePerClick = None
    CurrentDate_DayLimiter = None
    CurrentDate_MonthLimiter = None
    CurrentDate_MinuteLimiter = None
    CurrentDate_SecondLimiter = None
    CurrentDate_YearLimiter = None
    Current_MoneyMinimun = None
    SaveDataLoaded = None
    triggered_tutorials = list()
    WelcomeMessageTriggered = None
    BankruptWarning = None
    LowerMoneyWarning = None
    PlanetID = None
    PlanetName = None

    storeWindow.ReloadItemsList()
    expStoreWindow.ReloadItemsList()
    gameItems.RestartItems()
    gameScr.IncomingLog.Unload()
    maintenance.Unload()
Exemplo n.º 6
0
def GameDraw(DISPLAY):
    global BackToMainMenuButton
    global OpenStoreButton
    global OpenInfosWindowButton
    global OpenExperienceWindowButton
    global StoreWindow_Enabled
    global ItemsView
    global SavingScreenEnabled
    global BlinkExperienceValue
    global HUD_Surface

    if SavingScreenEnabled:
        UpdateSavingScreen(DISPLAY)

    if not SavingScreenEnabled:
        # -- Draw the Grind Text -- #
        IncomingLog.Draw(DISPLAY)
        # -- Draw the Grind Button -- #
        GrindButton.Render(DISPLAY)
        # -- Draw the Options Button -- #
        GameOptionsButton.Render(DISPLAY)
        # -- Draw the Save Button -- #
        SaveButton.Render(DISPLAY)
        # -- Draw the BackToMenu button -- #
        BackToMainMenuButton.Render(DISPLAY)
        # -- Draw the Store Button -- #
        OpenStoreButton.Render(DISPLAY)
        # -- Draw the Items View -- #
        ItemsView.Render(DISPLAY)
        # -- Draw the OpenInfosWindow -- #
        OpenInfosWindowButton.Render(DISPLAY)
        # -- Draw the OpenExperience -- #
        if gameItems.GetItemCount_ByID(-1) == 1:
            OpenExperienceWindowButton.Render(DISPLAY)

        # -- Render Money Text -- #
        MoneyColor = (250, 250, 255)
        PerSecoundColor = (220, 220, 220)
        if save.Current_Money > 0.1:
            MoneyColor = (120, 220, 120)
        elif save.Current_Money <= 0:
            MoneyColor = (220, 10, 10)
        if save.Current_MoneyPerSecond > 0.1:
            PerSecoundColor = (50, 200, 50)
        elif save.Current_MoneyPerSecond <= 0:
            PerSecoundColor = (120, 10, 10)

        # -- Render Current Money, at Top -- #
        MoneyText = gameMain.DefaultCnt.Get_RegKey(
            "/strings/game/money") + save.Current_MoneyFormated
        gameMain.DefaultCnt.FontRender(
            DISPLAY, "/PressStart2P.ttf", 18,
            gameMain.DefaultCnt.Get_RegKey("/strings/game/money") +
            save.Current_MoneyFormated, (0, 0, 0), 12, 22)
        gameMain.DefaultCnt.FontRender(DISPLAY, "/PressStart2P.ttf", 18,
                                       MoneyText, MoneyColor, 10, 20)

        # -- Render Money per Second -- #
        MoneyPerSecoundText = gameMain.DefaultCnt.Get_RegKey(
            "/strings/game/money_per_secound"
        ) + save.Current_MoneyPerSecondFormatted
        gameMain.DefaultCnt.FontRender(DISPLAY, "/PressStart2P.ttf", 18,
                                       MoneyPerSecoundText, (0, 0, 0), 12, 52)
        gameMain.DefaultCnt.FontRender(DISPLAY, "/PressStart2P.ttf", 18,
                                       MoneyPerSecoundText, PerSecoundColor,
                                       10, 50)

        # -- Render Experience -- #
        ExperienceText = gameMain.DefaultCnt.Get_RegKey(
            "/strings/game/experience") + str(
                save.Current_ExperienceFormated) + "/" + str(
                    save.Current_TotalClicks -
                    save.Current_TotalClicksNext) + "=" + str(
                        save.Current_ExperiencePerEach)
        gameMain.DefaultCnt.FontRender(
            DISPLAY, "/PressStart2P.ttf", 18, ExperienceText,
            (BlinkExperienceValue, BlinkExperienceValue, BlinkExperienceValue),
            12, 82)
        gameMain.DefaultCnt.FontRender(
            DISPLAY, "/PressStart2P.ttf", 18, ExperienceText,
            (140 + BlinkExperienceValue, 130 + BlinkExperienceValue,
             120 + BlinkExperienceValue), 10, 80)

        # -- Render the Clock -- #
        gameClock.Draw(DISPLAY)

        # -- Draw the Store Window -- #
        if StoreWindow_Enabled:
            storeWindow.Render(DISPLAY)

        # -- Draw the Infos Window -- #
        if InfosWindow_Enabled:
            infosWindow.Render(DISPLAY)

        # -- Draw the Exp Store Window -- #
        if ExperienceStore_Enabled and gameItems.GetItemCount_ByID(-1) >= 1:
            expStoreWindow.Render(DISPLAY)

        HUD_Surface = DISPLAY.copy()
Exemplo n.º 7
0
def Update():
    global GameOptionsButton
    global BackToMainMenuButton
    global OpenStoreButton
    global StoreWindow_Enabled
    global ItemsView
    global BackToMainMenu_Delay
    global BackToMainMenu
    global IsControlsEnabled
    global SavingScreenEnabled
    global ExperienceStore_Enabled
    global InfosWindow_Enabled

    if IsControlsEnabled:
        # -- Update Save -- #
        save.Update()

        # -- Update Experience Blink -- #
        UpdateExperienceBlink()

        ItemsView.Set_X(5)
        ItemsView.Set_Y(gameMain.DefaultDisplay.get_height() - 130)

        # -- Update General Maintenance -- #
        maintenance.Update()

        # -- Update Buttons Click -- #
        if GrindButton.ButtonState == 2:
            save.TutorialTrigger("clicking_button")
            save.GrindClick()

        # -- Game Options Button -- #
        if GameOptionsButton.ButtonState == 2:
            transition.Run()
            ScreenSettings.ScreenToReturn = 1
            ScreenSettings.Initialize()
            storeWindow.RestartAnimation()
            gameMain.SetScreen_ByID(2)

        # -- Save Buttons -- #
        if SaveButton.ButtonState == 2:
            SavingScreenEnabled = True
            IsControlsEnabled = False

        # -- Back to Main Menu Button -- #
        if BackToMainMenuButton.ButtonState == 2:
            transition.Run()
            BackToMainMenu = True

        if BackToMainMenu:
            BackToMainMenu_Delay += 1

            if BackToMainMenu_Delay >= 5:
                gameMain.SetScreen_ByID(0)
                # -- Reset Variables -- #
                BackToMainMenu_Delay = 0
                BackToMainMenu = False

                SaveGame()

        # -- Store Button -- #
        if OpenStoreButton.ButtonState == 2:
            save.TutorialTrigger("store_window_button")

            if StoreWindow_Enabled:
                StoreWindow_Enabled = False
                storeWindow.RestartAnimation()
            else:
                StoreWindow_Enabled = True
                InfosWindow_Enabled = False
                ExperienceStore_Enabled = False

        # -- Infos Button -- #
        elif OpenInfosWindowButton.ButtonState == 2:
            save.TutorialTrigger("infos_window_button")

            if InfosWindow_Enabled:
                InfosWindow_Enabled = False
            else:
                InfosWindow_Enabled = True
                StoreWindow_Enabled = False
                ExperienceStore_Enabled = False

        # -- Experience Store Button -- #
        elif OpenExperienceWindowButton.ButtonState == 2 and gameItems.GetItemCount_ByID(
                -1) >= 1:
            save.TutorialTrigger("expstore_window_button")

            if ExperienceStore_Enabled:
                ExperienceStore_Enabled = False
                expStoreWindow.RestartAnimation()

            else:
                ExperienceStore_Enabled = True
                StoreWindow_Enabled = False
                InfosWindow_Enabled = False

        # -- Update Buttons Location -- #
        GameOptionsButton.Set_X(gameMain.DefaultDisplay.get_width() - 120)
        SaveButton.Set_X(gameMain.DefaultDisplay.get_width() - 120)
        BackToMainMenuButton.Set_X(gameMain.DefaultDisplay.get_width() - 120)
        GrindButton.Rectangle[2] = 130
        GrindButton.Rectangle[3] = 150
        OpenStoreButton.Set_X(5)
        OpenStoreButton.Set_Y(gameMain.DefaultDisplay.get_height() -
                              OpenStoreButton.Rectangle[3] - 5)
        OpenInfosWindowButton.Set_X(OpenStoreButton.Rectangle[0] +
                                    OpenStoreButton.Rectangle[2] + 5)
        OpenInfosWindowButton.Set_Y(OpenStoreButton.Rectangle[1])
        OpenExperienceWindowButton.Set_X(OpenInfosWindowButton.Rectangle[0] +
                                         OpenInfosWindowButton.Rectangle[2] +
                                         5)
        OpenExperienceWindowButton.Set_Y(OpenInfosWindowButton.Rectangle[1])

        # -- Update Windows -- #
        WindowsUpdate()

        # -- Update Objects -- #
        IncomingLog.Update()
        gameClock.Update()