class NiceGUISettings extends UT2K4TabPanel;

// GENERAL WEAPON SETTINGS
var automated  GUISectionBackground     bg_WEAP;
var automated  moCheckBox      ch_WeapManagement;
var automated  moCheckBox      ch_AltSwitches;
var automated  moCheckBox      ch_DispCounters;
var automated  moCheckBox      ch_DisWeapProgress;
var automated  moCheckBox      ch_ShowHLMessages;

// WEAPON RELOAD SETTINGS
var automated  GUISectionBackground     bg_RELOAD;
var automated  moCheckBox      ch_CancelFire;
var automated  moCheckBox      ch_CancelSwitching;
var automated  moCheckBox      ch_CancelNades;
var automated  moCheckBox      ch_CancelAiming;
var automated  moCheckBox      ch_ReloadWontWork;

// RANDOM SETTINGS
var automated  GUISectionBackground     bg_RANDOM;
var automated  MoComboBox      mo_ZedHPBars;

function InitComponent(GUIController MyController, GUIComponent MyOwner)
{
    super.InitComponent(MyController, MyOwner);

    mo_ZedHPBars.AddItem("Big Zeds");
    mo_ZedHPBars.AddItem("All Zeds");
    mo_ZedHPBars.AddItem("Disable");

    // GENERAL WEAPON SETTINGS
    bg_WEAP.ManageComponent(ch_WeapManagement);
    bg_WEAP.ManageComponent(ch_AltSwitches);
    bg_WEAP.ManageComponent(ch_DispCounters);
    bg_WEAP.ManageComponent(ch_DisWeapProgress);
    bg_WEAP.ManageComponent(ch_ShowHLMessages);

    // WEAPON RELOAD SETTINGS
    bg_RELOAD.ManageComponent(ch_CancelFire);
    bg_RELOAD.ManageComponent(ch_CancelSwitching);
    bg_RELOAD.ManageComponent(ch_CancelNades);
    bg_RELOAD.ManageComponent(ch_CancelAiming);
    bg_RELOAD.ManageComponent(ch_ReloadWontWork);

    // RANDOM SETTINGS
    bg_RANDOM.ManageComponent(mo_ZedHPBars);
}

function InternalOnLoadINI(GUIComponent sender, string s)
{
    local NicePlayerController nicePlayer;

    nicePlayer = NicePlayerController(PlayerOwner());
    if (nicePlayer == none)
        return;

    switch(sender)
    {
        case ch_WeapManagement:
            ch_WeapManagement.Checked(nicePlayer.bNiceWeaponManagement);
            break;
        case ch_AltSwitches:
            ch_AltSwitches.Checked(nicePlayer.bFlagAltSwitchesModes);
            break;
        case ch_DispCounters:
            ch_DispCounters.Checked(nicePlayer.bFlagDisplayCounters);
            break;
        case ch_DisWeapProgress:
            ch_DisWeapProgress.Checked(nicePlayer.bFlagDisplayWeaponProgress);
            break;
        case ch_ShowHLMessages:
            ch_ShowHLMessages.Checked(nicePlayer.bFlagShowHLMessages);
            break;
        case ch_CancelFire:
            ch_CancelFire.Checked(nicePlayer.bRelCancelByFire);
            break;
        case ch_CancelSwitching:
            ch_CancelSwitching.Checked(nicePlayer.bRelCancelBySwitching);
            break;
        case ch_CancelNades:
            ch_CancelNades.Checked(nicePlayer.bRelCancelByNades);
            break;
        case ch_CancelAiming:
            ch_CancelAiming.Checked(nicePlayer.bRelCancelByAiming);
            break;
        case ch_ReloadWontWork:
            ch_ReloadWontWork.Checked(nicePlayer.bFlagUseServerReload);
            break;
        case mo_ZedHPBars:
            mo_ZedHPBars.SetIndex(nicePlayer.ZedHPBarStyle);
            break;
    }
}

function InternalOnChange(GUIComponent Sender)
{
    local NicePlayerController nicePlayer;

    nicePlayer = NicePlayerController(PlayerOwner());
    if (nicePlayer == none)
        return;

    switch(sender)
    {
        case ch_WeapManagement:
            nicePlayer.bNiceWeaponManagement = ch_WeapManagement.IsChecked();
            break;
        case ch_AltSwitches:
            nicePlayer.ServerSetAltSwitchesModes(ch_AltSwitches.IsChecked());
            break;
        case ch_DispCounters:
            nicePlayer.ServerSetDisplayCounters(ch_DispCounters.IsChecked());
            break;
        case ch_DisWeapProgress:
            nicePlayer.ServerSetDisplayWeaponProgress(ch_DisWeapProgress.IsChecked());
            break;
        case ch_ShowHLMessages:
            nicePlayer.ServerSetHLMessages(ch_ShowHLMessages.IsChecked());
            break;
        case ch_CancelFire:
            nicePlayer.bRelCancelByFire = ch_CancelFire.IsChecked();
            break;
        case ch_CancelSwitching:
            nicePlayer.bRelCancelBySwitching = ch_CancelSwitching.IsChecked();
            break;
        case ch_CancelNades:
            nicePlayer.bRelCancelByNades = ch_CancelNades.IsChecked();
            break;
        case ch_CancelAiming:
            nicePlayer.bRelCancelByAiming = ch_CancelAiming.IsChecked();
            break;
        case ch_ReloadWontWork:
            nicePlayer.ServerSetUseServerReload(ch_ReloadWontWork.IsChecked());
            break;
        case mo_ZedHPBars:
            nicePlayer.ZedHPBarStyle = mo_ZedHPBars.GetIndex();
            break;
    }
    nicePlayer.ClientSaveConfig();
}

// size = (x=0.0125, y=0.0) ; (w=1.0, h=0.865)
// tab order
defaultproperties
{
    // GENERAL WEAPON SETTINGS
    Begin Object Class=GUISectionBackground Name=WEAPBG
        Caption="General weapon settings"
        WinTop=0.012500
        WinWidth=0.495000
        WinHeight=0.287500
        RenderWeight=0.100100
        // OnPreDraw=WeaponsBG.InternalPreDraw
        OnPreDraw=WEAPBG.InternalPreDraw
    End Object
    bg_WEAP=WEAPBG

    Begin Object Class=moCheckBox Name=WeaponManagement
        Caption="Nice weapon management"
        ComponentClassName="NicePack.NiceGUICheckBoxButton"
        OnCreateComponent=WeaponManagement.InternalOnCreateComponent
        IniOption="@Internal"
        Hint="If checked, NicePack will use it's own system to manage weapon switching"
        OnChange=NiceGUISettings.InternalOnChange
        OnLoadINI=NiceGUISettings.InternalOnLoadINI
    End Object
    ch_WeapManagement=WeaponManagement

    Begin Object Class=moCheckBox Name=AltSwitches
        Caption="Alt fire switches modes"
        ComponentClassName="NicePack.NiceGUICheckBoxButton"
        OnCreateComponent=AltSwitches.InternalOnCreateComponent
        IniOption="@Internal"
        Hint="Assault-rifle only; if enabled - alt fire button switches between fire modes, otherwise - acts as an alt fire"
        OnChange=NiceGUISettings.InternalOnChange
        OnLoadINI=NiceGUISettings.InternalOnLoadINI
    End Object
    ch_AltSwitches=AltSwitches

    Begin Object Class=moCheckBox Name=DispCounters
        Caption="Display counters"
        ComponentClassName="NicePack.NiceGUICheckBoxButton"
        OnCreateComponent=DispCounters.InternalOnCreateComponent
        IniOption="@Internal"
        Hint="Toggles display of the various counters used by skills"
        OnChange=NiceGUISettings.InternalOnChange
        OnLoadINI=NiceGUISettings.InternalOnLoadINI
    End Object
    ch_DispCounters=DispCounters

    Begin Object Class=moCheckBox Name=DispWeapProgress
        Caption="Display weapon progress"
        ComponentClassName="NicePack.NiceGUICheckBoxButton"
        OnCreateComponent=DispWeapProgress.InternalOnCreateComponent
        IniOption="@Internal"
        Hint="Displays weapon progress rate, however it's defined by a skill that's using this functionality"
        OnChange=NiceGUISettings.InternalOnChange
        OnLoadINI=NiceGUISettings.InternalOnLoadINI
    End Object
    ch_DisWeapProgress=DispWeapProgress

    Begin Object Class=moCheckBox Name=ShowHLMessages
        Caption="Show Hardcore Level messages"
        ComponentClassName="NicePack.NiceGUICheckBoxButton"
        OnCreateComponent=ShowHLMessages.InternalOnCreateComponent
        IniOption="@Internal"
        Hint="Enable to be notified each time Hardcore Level is changed"
        OnChange=NiceGUISettings.InternalOnChange
        OnLoadINI=NiceGUISettings.InternalOnLoadINI
    End Object
    ch_ShowHLMessages=ShowHLMessages

    // WEAPON RELOAD SETTINGS
    Begin Object Class=GUISectionBackground Name=RELOADBG
        Caption="Weapon reload settings"
        WinTop=0.012500
        WinLeft=0.505000
        WinWidth=0.495000
        WinHeight=0.287500
        RenderWeight=0.100100
        // OnPreDraw=WeaponsBG.InternalPreDraw
        OnPreDraw=RELOADBG.InternalPreDraw
    End Object
    bg_RELOAD=RELOADBG

    Begin Object Class=moCheckBox Name=CancelFire
        Caption="Cancel reload by shooting"
        ComponentClassName="NicePack.NiceGUICheckBoxButton"
        OnCreateComponent=CancelFire.InternalOnCreateComponent
        IniOption="@Internal"
        Hint="If checked, you'll be able to cancel reload of converted weapons by shooting (when you have ammo)"
        OnChange=NiceGUISettings.InternalOnChange
        OnLoadINI=NiceGUISettings.InternalOnLoadINI
    End Object
    ch_CancelFire=CancelFire

    Begin Object Class=moCheckBox Name=CancelSwitching
        Caption="Cancel reload by switching weapons"
        ComponentClassName="NicePack.NiceGUICheckBoxButton"
        OnCreateComponent=CancelSwitching.InternalOnCreateComponent
        IniOption="@Internal"
        Hint="If checked, you'll be able to cancel reload of converted weapons by switching to different weapon"
        OnChange=NiceGUISettings.InternalOnChange
        OnLoadINI=NiceGUISettings.InternalOnLoadINI
    End Object
    ch_CancelSwitching=CancelSwitching

    Begin Object Class=moCheckBox Name=CancelNades
        Caption="Cancel reload by throwing grenades"
        ComponentClassName="NicePack.NiceGUICheckBoxButton"
        OnCreateComponent=CancelNades.InternalOnCreateComponent
        IniOption="@Internal"
        Hint="If checked, you'll be able to cancel reload of converted weapons by throwing a grenade"
        OnChange=NiceGUISettings.InternalOnChange
        OnLoadINI=NiceGUISettings.InternalOnLoadINI
    End Object
    ch_CancelNades=CancelNades

    Begin Object Class=moCheckBox Name=CancelAiming
        Caption="Cancel reload by aiming"
        ComponentClassName="NicePack.NiceGUICheckBoxButton"
        OnCreateComponent=CancelAiming.InternalOnCreateComponent
        IniOption="@Internal"
        Hint="If checked, you'll be able to cancel reload of converted weapons by going into iron sights (when you have ammo)"
        OnChange=NiceGUISettings.InternalOnChange
        OnLoadINI=NiceGUISettings.InternalOnLoadINI
    End Object
    ch_CancelAiming=CancelAiming

    Begin Object Class=moCheckBox Name=ServerReload
        Caption="My reload doesn't work"
        ComponentClassName="NicePack.NiceGUICheckBoxButton"
        OnCreateComponent=ServerReload.InternalOnCreateComponent
        IniOption="@Internal"
        Hint="Check this option ONLY in case converted weapons don't reload at all for you; this option should fix the problem, but then latency will affect both reload and active reload"
        OnChange=NiceGUISettings.InternalOnChange
        OnLoadINI=NiceGUISettings.InternalOnLoadINI
    End Object
    ch_ReloadWontWork=ServerReload

    // RANDOM SETTINGS
    Begin Object Class=GUISectionBackground Name=randbg
        Caption="Random settings"
        WinTop=0.300000
        WinWidth=0.495000
        WinHeight=0.287500
        WinLeft=0.505000
        RenderWeight=0.100100
        // OnPreDraw=WeaponsBG.InternalPreDraw
        OnPreDraw=randbg.InternalPreDraw
    End Object
    bg_RANDOM=randbg

    Begin Object class=moComboBox Name=zedhbarpmethod
        bReadOnly=true
        CaptionWidth=0.000000
        Caption="Zed health bars"
        Hint="Choose what health bars you want to see"
        OnCreateComponent=zedhbarpmethod.InternalOnCreateComponent
        OnChange=NiceGUISettings.InternalOnChange
        OnLoadINI=NiceGUISettings.InternalOnLoadINI
    End Object
    mo_ZedHPBars=zedhbarpmethod
}