Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

# TribesGUI.ConfigManager

00001 00002 00003 00004 00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101

    //
    //
    class ConfigManager extends Engine.Actor
    	Config(CustomControllerConfigs);

    var config String			activeConfigName;
    var config Array<String>	configNames;

    var private Array<ControllerConfig>	configs;
    var private ControllerConfig		activeConfig;
    var private DefaultControllerConfig	defaultConfig;

    //
    // Initialises the ConfigManager. This involves creating
    // the configs from the strings loaded from the config file
    //
    simulated function PostBeginPlay()
    {
    	local int i;

    	super.PostBeginPlay();

    	for(i = 0; i < configNames.Length; ++i)
    	{
    		configs[i] = new(None, configNames[i]) class'ControllerConfig';
    		if(configNames[i] == activeConfigName)
    			activeConfig = configs[i];
    	}

    	defaultConfig = new class'DefaultControllerConfig';
    	if(activeConfig == None)
    		activeConfig = defaultConfig;
    }

    //
    // Gets the active profile
    //
    simulated function ControllerConfig GetActiveConfig()
    {
    	return activeConfig;
    }

    //
    // Sets the active profile. If the profile cannot be
    // found in the list of configs it is added automatically
    //
    simulated function SetActiveConfig(ControllerConfig newActiveConfig)
    {
    	local int i;
    	local bool bFound;

    	for(i = 0; i < configs.Length; ++i)
    	{
    		if(configs[i] == newActiveConfig)
    			bfound = true;
    	}

    	if(! bFound)
    		configs[configs.Length] = newActiveConfig;

    	activeConfig = newActiveConfig;
    	activeConfigName = string(activeConfig.name);
    }

    //
    // Creates a new profile, adds it to the list and returns it.
    //
    simulated function ControllerConfig NewConfig(String newName)
    {
    	local ControllerConfig config;

    	config = new(None, newName) class'ControllerConfig';

    	configs[configs.Length] = config;
    	configNames[configs.Length] = string(config.name);

    	return config;
    }

    //
    // Deletes an existing profile
    //
    simulated function DeleteConfig(ControllerConfig config)
    {
    	local int i;

    	for(i = configs.Length - 1; i >= 0; --i)
    	{
    		if(configs[i] == config)
    		{
    			configs.Remove(i, 1);
    			configNames.Remove(i, 1);
    			config.Destroy();
    		}
    	}
    }

    defaultproperties
    {
    	bHidden = true
    }

Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

Class file time: st 16.4.2014 10:20:44.000 - Creation time: st 23.5.2018 00:10:42.898 - Created with UnCodeX