Exemplo n.º 1
0
 void SetButtonProperties(ButtonProperties buttonProperties)
 {
     buttonImage.texture    = buttonProperties.buttonTexture;
     buttonText.text        = buttonProperties.buttonText;
     buttonAudioSource.clip = buttonProperties.buttonAudioClip;
     buttonImage.color      = buttonProperties.buttonColor;
 }
Exemplo n.º 2
0
    public void SetAnswerButtonProperties(ButtonProperties buttonProperties, bool forceInitializeButton = false)
    {
        //    Debug.Log("Setting Answer Button Properties");

        if (m_Image == null || m_Button == null || m_ButtonText == null || forceInitializeButton)
        {
            InitializeAnswerButton();
        }

        if (buttonProperties.image != null)
        {
            this.image = buttonProperties.image;
        }
        else
        {
            this.image = GetCorrectSpriteByID.Instance.GetSpriteFromID(SpriteID.DummySprite);
        }
        this.ButtonText = buttonProperties.ButtonText;

        Debug.Log("BUtton Text COlor = " + buttonProperties.ButtonTextColor.ToString());

        this.ButtonTextColor = buttonProperties.ButtonTextColor;
        this.ID                        = buttonProperties.ID;
        this.isCorrect                 = buttonProperties.isCorrect;
        this.sequenceOfClick           = buttonProperties.SequenceInfo;
        this.secondaryImages           = buttonProperties.secondaryImages;
        this.OnClickAction             = buttonProperties.OnClickAction;
        currentSelectedSecondarySprite = 0;

        SetAllData();
    }
Exemplo n.º 3
0
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        // Destroys all the spinners
        foreach (GameObject car in spinners)
        {
            Destroy(car);
        }

        // Instantiate prefab
        ButtonProperties data    = animator.gameObject.GetComponent <ButtonProperties>();
        GameObject       spinner = Instantiate(data.carPrefab, data.parent.transform);

        // Disable wheel colliders or unity spergs in the log

        Controller controller = FindObjectOfType <Controller>();

        controller.CarScriptKill(spinner);

        // Set transform
        spinner.transform.localScale    = new Vector3(120, 120, 120);
        spinner.transform.localPosition = new Vector3(220, -50, -200);

        // Add rotation script
        spinner.AddComponent <Spinner>();

        // Keep track for the spinner
        spinners.Add(spinner);
    }
Exemplo n.º 4
0
 private void SetCorrectIndex(ButtonProperties bProp, int index)
 {
     if (bProp.ID == AnswerID.Correct)
     {
         correctIndex = index;
     }
 }
Exemplo n.º 5
0
 void PopulateList()
 {
     foreach (var item in itemList)
     {
         GameObject       newButton     = Object.Instantiate(sampleButtonPrefab) as GameObject;
         ButtonProperties exampleButton = newButton.GetComponent <ButtonProperties>();
         exampleButton.buttonName.text = item.itemName;
         newButton.transform.SetParent(this.contentPanel.transform);
     }
 }
Exemplo n.º 6
0
        private SPButton BuildButton(object data, BuildContext bc)
        {
            ButtonProperties properties =
                DataNodeWrapper.GetNodeAttributes(data).To <ButtonProperties>();
            SPButton fsea = new SPButton(Root,
                                         properties.Id,
                                         properties);

            return(fsea);
        }
Exemplo n.º 7
0
    protected override void Set()
    {
        List <ButtonProperties> buttonProperties = new List <ButtonProperties>();

        for (int i = 0; i < info.Options.Count; i++)
        {
            Action <int, int, bool, List <SequenceOfClick> > actionOnClick = info.Options[i].IsCorrect ? CorrectlyAnswered : WronglyAnswered;

            ButtonProperties button = new ButtonProperties(info.Options[i].Sprite, info.Options[i].SecondarySprites, info.Options[i].text, info.Options[i].ID, actionOnClick, info.Options[i].IsCorrect, info.Options[i].SequenceInfo);
            buttonProperties.Add(button);
        }
        QuestionUIInfo ifelse = new QuestionUIInfo(info.Question, info.SecondaryQuestion, null, info.QuestionData_Float, info.QuestionData_Int, buttonProperties);

        UIManager.Instance.SetUI(info.Pattern, ifelse);
    }
Exemplo n.º 8
0
    public void Generate()
    {
        RectTransform itemPrefabTransform = itemPrefab.GetComponent <RectTransform>();
        RectTransform containerTransform  = this.gameObject.GetComponent <RectTransform>();

        float width  = containerTransform.rect.width;
        float ratio  = width / itemPrefabTransform.rect.width;
        float height = itemPrefabTransform.rect.height * ratio;

        float scrollHeight = height * (float)this.HostDataArray.Length;

        containerTransform.offsetMin = new Vector2(containerTransform.offsetMin.x, -scrollHeight / 2f);
        containerTransform.offsetMax = new Vector2(containerTransform.offsetMax.x, scrollHeight / 2f);

        for (int i = 0; i < this.HostDataArray.Length; i++)
        {
            GameObject newItem = (GameObject)Object.Instantiate <GameObject>(itemPrefab);
            newItem.name = newItem.name + " " + i.ToString();
            ButtonProperties exampleButton = newItem.GetComponent <ButtonProperties>();
            exampleButton.buttonName.text = this.HostDataArray[i].gameName;
            newItem.transform.SetParent(this.gameObject.transform, false);

            //RectTransform newItemTransform = newItem.GetComponent<RectTransform>();
            //float x = -containerTransform.rect.width / 2f;
            //float y = containerTransform.rect.height / 2f - 30f;
            //newItemTransform.offsetMin = new Vector2(x, y);

            //x = newItemTransform.offsetMin.x + containerTransform.rect.width - (containerTransform.rect.width / 10f);
            //y = newItemTransform.offsetMin.y + 30f;
            //newItemTransform.offsetMax = new Vector2(x, y);

            ServerEntryActions actions = newItem.GetComponent <ServerEntryActions>();
            if (actions != null)
            {
                actions.data = this.HostDataArray[i];
            }
        }
    }
        public IHtmlContent RenderButton(StandardButtons buttonType,
                                         string arguments,
                                         string cssClass,
                                         ContextualizedHelpers helpers,
                                         IStringLocalizer localizer,
                                         bool visibleText   = false,
                                         bool isSubmit      = false,
                                         string controlType = null)
        {
            ButtonProperties currentButton = null;

            allButtonProperties.TryGetValue(buttonType, out currentButton);
            if (currentButton == null)
            {
                return(new HtmlString(string.Empty));
            }
            if (isSubmit)
            {
                return(new HtmlString(string.Format(visibleText ? buttonTemplateWithTextSubmit: buttonTemplateSubmit,
                                                    cssClass ?? string.Empty,
                                                    localizer != null ?
                                                    localizer[currentButton.ShowText] : currentButton.ShowText,
                                                    currentButton.IconClass
                                                    )));
            }
            else
            {
                return(new HtmlString(string.Format(visibleText ? buttonTemplateWithText : buttonTemplate,
                                                    currentButton.OperationName,
                                                    arguments ?? string.Empty,
                                                    cssClass ?? string.Empty,
                                                    localizer != null ?
                                                    localizer[currentButton.ShowText] : currentButton.ShowText,
                                                    currentButton.IconClass,
                                                    controlType == null ? string.Empty : "data-control-type='" + controlType + "'"
                                                    )));
            }
        }
Exemplo n.º 10
0
        public Theme(string themeName)
        {
            path = "themes\\" + themeName;
           

            // if theme not found pick the first theme on theme dir
            if (!File.Exists(Directory.GetCurrentDirectory() + "\\" + path + "\\settings.ini"))
            {
                System.Windows.MessageBox.Show("Could not find theme named '" + themeName + "' from '" + Directory.GetCurrentDirectory() + "\\" + path + "\\'");

                DirectoryInfo d = new DirectoryInfo(Directory.GetCurrentDirectory() + "\\themes\\");
                DirectoryInfo[] dis = d.GetDirectories();
                foreach (DirectoryInfo di in dis)
                {
                    if (File.Exists(Directory.GetCurrentDirectory() + "\\themes\\" + di.Name + "\\settings.ini"))
                    {
                        themeName = di.Name;
                        break;
                    }
                }
            }

            path = "themes\\" + themeName;
            name = themeName;
            fontCache = new FontCache();
            fontCache.SetPath(Path.Combine(Directory.GetCurrentDirectory(), "themes\\" + themeName));

            settings = new CfgFile(path + "\\settings.ini");

            if (getIniValueBool("General", "dynamic"))
            {
                logger.Info("Dynamic Theme configuration activated");
                List<string> secs = settings.getAllSections();
                Dictionary<string, List<string>> secStuff = new Dictionary<string, List<string>>();
                
                foreach (string s in secs)
                {
                    string[] parts = s.Split('-');
                    if (parts.Length != 2)
                        continue;
                    if ( !secStuff.ContainsKey( parts[0].ToLowerInvariant() ) )
                        secStuff[parts[0].ToLowerInvariant()] = new List<string>();
                    secStuff[parts[0].ToLowerInvariant()].Add(parts[1]);
                }
                foreach( string k in secStuff.Keys )
                {
                    logger.Info("Setting {0}s = {1}",k,String.Join(",", secStuff[k]));
                    settings.setValue("General", k+"s", String.Join(",", secStuff[k]), false);
                }
            }
            string filename = Directory.GetCurrentDirectory() + "\\themes\\" + name + "\\tracks.ini";
            if (!File.Exists(filename))
                filename = Directory.GetCurrentDirectory() + "\\tracks.ini";

            if (File.Exists(filename))
            {
                TrackNames = new CfgFile(filename);                
            }


            
            width = Int32.Parse(getIniValue("General", "width"));
            height = Int32.Parse(getIniValue("General", "height"));

            defaultFont = settings.getValue("General", "font", false, "Arial", false);

            // point schema
            pointscol = Int32.Parse(getIniValue("General", "pointscol"));
            minscoringdistance = Single.Parse(getIniValue("General", "minscoringdistance"))/100;
            if (minscoringdistance == 0.0f)
                minscoringdistance = 1.0f;
            string[] pointschemastr = getIniValue("General", "pointschema").Split(',');
            pointschema = new Int32[pointschemastr.Length];
            for (int i = 0; i < pointschemastr.Length; i++)
                pointschema[i] = Int32.Parse(pointschemastr[i]);

            // load objects
            string tmp = getIniValue("General", "overlays");
            string[] overlays;
            if (tmp != "0")
            {
                overlays = tmp.Split(',');
                objects = new ObjectProperties[overlays.Length];
            }
            else
            {
                objects = new ObjectProperties[0];
                overlays = new string[0];
            }

            for(int i = 0; i < overlays.Length; i++) {

                objects[i].name = overlays[i];
                objects[i].width = Int32.Parse(getIniValue("Overlay-" + overlays[i], "width"));
                objects[i].height = Int32.Parse(getIniValue("Overlay-" + overlays[i], "height"));
                objects[i].left = Int32.Parse(getIniValue("Overlay-" + overlays[i], "left"));
                objects[i].top = Int32.Parse(getIniValue("Overlay-" + overlays[i], "top"));
                objects[i].zIndex = Int32.Parse(getIniValue("Overlay-" + overlays[i], "zIndex"));
                objects[i].offset = Int32.Parse(getIniValue("Overlay-" + overlays[i], "offset"));
                objects[i].dataset = (DataSets)Enum.Parse(typeof(DataSets), getIniValue("Overlay-" + overlays[i], "dataset"));

                if (getIniValue("Overlay-" + overlays[i], "class") != "0")
                    objects[i].carclass = getIniValue("Overlay-" + overlays[i], "class");
                else
                    objects[i].carclass = null;

                if (getIniValue("Overlay-" + overlays[i], "fixed") == "true")
                    objects[i].presistent = true;
                else
                    objects[i].presistent = false;

                if (getIniValue("Overlay-" + overlays[i], "leader") != "0")
                    objects[i].leadervalue = getIniValue("Overlay-" + overlays[i], "leader");
                else
                    objects[i].leadervalue = null;
                objects[i].session = (SessionTypes)Enum.Parse(typeof(SessionTypes), getIniValue("Overlay-" + overlays[i], "session"));
                int extraHeight = 0;

                // load labels
                tmp = getIniValue("Overlay-" + overlays[i], "labels");
                string[] labels = tmp.Split(',');
                objects[i].labels = new LabelProperties[labels.Length];
                for (int j = 0; j < labels.Length; j++)
                {
                    objects[i].labels[j] = loadLabelProperties("Overlay-" + overlays[i], labels[j]);
                    if (objects[i].labels[j].height > extraHeight)
                        extraHeight = objects[i].labels[j].height;
                    if (objects[i].labels[j].session == SessionTypes.none)
                        objects[i].labels[j].session = objects[i].session;
                }

                if (objects[i].dataset == DataSets.standing || objects[i].dataset == DataSets.points || objects[i].dataset == DataSets.pit)
                {
                    objects[i].itemCount = Int32.Parse(getIniValue("Overlay-" + overlays[i], "number"));
                    objects[i].itemSize = Int32.Parse(getIniValue("Overlay-" + overlays[i], "itemHeight"));
                    objects[i].itemSize += Int32.Parse(getIniValue("Overlay-" + overlays[i], "itemsize"));
                    objects[i].height = Math.Max(objects[i].height, (objects[i].itemCount * objects[i].itemSize) + extraHeight);
                    objects[i].page = -1;
                    objects[i].direction = (direction)Enum.Parse(typeof(direction), getIniValue("Overlay-" + overlays[i], "direction"));
                    objects[i].offset = Int32.Parse(getIniValue("Overlay-" + overlays[i], "offset"));
                    objects[i].maxpages = Int32.Parse(getIniValue("Overlay-" + overlays[i], "maxpages"));
                    objects[i].skip = Int32.Parse(getIniValue("Overlay-" + overlays[i], "skip"));
                }

                switch (getIniValue("Overlay-" + overlays[i], "dataorder"))
                {
                    case "fastestlap":
                        objects[i].dataorder = DataOrders.fastestlap;
                        break;
                    case "previouslap":
                        objects[i].dataorder = DataOrders.previouslap;
                        break;
                    case "class":
                        objects[i].dataorder = DataOrders.previouslap;
                        break;
                    case "points":
                        objects[i].dataorder = DataOrders.points;
                        break;
                    case "liveposition":
                        objects[i].dataorder = DataOrders.liveposition;
                        break;
                    case "trackposition":
                        objects[i].dataorder = DataOrders.trackposition;
                        break;
                    default:
                        objects[i].dataorder = DataOrders.position;
                        break;
                }
                objects[i].visible = false;
            }

            // load images
            tmp = getIniValue("General", "images");
            string[] files;
            if (tmp != "0")
            {
                files = tmp.Split(',');
                images = new ImageProperties[files.Length];
            }
            else
            {
                images = new ImageProperties[0];
                files = new string[0];
            }
            
            for (int i = 0; i < files.Length; i++)
            {
                images[i].filename = getIniValue("Image-" + files[i], "filename");
                images[i].zIndex = Int32.Parse(getIniValue("Image-" + files[i], "zIndex"));
                images[i].visible = false;
                images[i].name = files[i];

                images[i].width = Int32.Parse(getIniValue("Image-" + files[i], "width"));
                images[i].height = Int32.Parse(getIniValue("Image-" + files[i], "height"));
                images[i].left = Int32.Parse(getIniValue("Image-" + files[i], "left"));
                images[i].top = Int32.Parse(getIniValue("Image-" + files[i], "top"));

                if (getIniValue("Image-" + files[i], "dynamic") == "true")
                {
                    images[i].dynamic = true;
                    images[i].defaultFile = getIniValue("Image-" + files[i], "default");
                }
                else
                    images[i].dynamic = false;

                if (getIniValue("Image-" + files[i], "fixed") == "true")
                    images[i].presistent = true;
                else
                    images[i].presistent = false;

                 if (getIniValue("Image-" + files[i], "animate") == "true")
                     images[i].doAnimate = true;
                 else
                     images[i].doAnimate = false;

            }

            // load videos
            tmp = getIniValue("General", "videos");
            if (tmp != "0")
            {
                files = tmp.Split(',');
                videos = new VideoProperties[files.Length];
            }
            else
            {
                videos = new VideoProperties[0];
                files = new string[0];
            }

            for (int i = 0; i < files.Length; i++)
            {
                videos[i].filename = getIniValue("Video-" + files[i], "filename");
                videos[i].zIndex = Int32.Parse(getIniValue("Video-" + files[i], "zIndex"));
                videos[i].width = Int32.Parse(getIniValue("Video-" + files[i], "width"));
                videos[i].height = Int32.Parse(getIniValue("Video-" + files[i], "height"));
                videos[i].left = Int32.Parse(getIniValue("Video-" + files[i], "left"));
                videos[i].top = Int32.Parse(getIniValue("Video-" + files[i], "top"));
                videos[i].visible = false;
                videos[i].playing = false;
                videos[i].name = files[i];
                videos[i].muteSimulator = getIniValueBool("Video-" + files[i], "mute");

                Double volume = 100.0;
                bool result = Double.TryParse(getIniValueWithDefault("Video-" + files[i], "volume", "100.0"), NumberStyles.AllowDecimalPoint, CultureInfo.CreateSpecificCulture("en-US"), out volume);
                if (!result)
                    volume = 100.0;
                
                videos[i].volume = Math.Min(volume / 100.0, 100.0);
                if (videos[i].volume <= 0)
                    videos[i].volume = 1.0;

                if (getIniValue("Video-" + files[i], "fixed") == "true")
                    videos[i].presistent = true;
                else
                    videos[i].presistent = false;

                if (getIniValue("Video-" + files[i], "loop") == "true")
                    videos[i].loop = true;
                else
                    videos[i].loop = false;
            }


            // load sounds
            tmp = getIniValue("General", "sounds");

            if (tmp != "0")
            {
                files = tmp.Split(',');
                sounds = new SoundProperties[files.Length];
            }
            else
            {
                sounds = new SoundProperties[0];
                files = new string[0];
            }

            for (int i = 0; i < files.Length; i++)
            {
                sounds[i].filename = getIniValue("Sound-" + files[i], "filename");
                sounds[i].playing = false;
                sounds[i].name = files[i];

                Double volume = 100.0;
                bool result = Double.TryParse(getIniValueWithDefault("Sound-" + files[i], "volume", "100.0"), NumberStyles.AllowDecimalPoint, CultureInfo.CreateSpecificCulture("en-US"), out volume);
                if (!result)
                    volume = 100.0;

                sounds[i].volume = Math.Min(volume / 100.0, 100.0);
                if (sounds[i].volume <= 0)
                    sounds[i].volume = 1.0;

                if (getIniValue("Sound-" + files[i], "loop") == "true")
                    sounds[i].loop = true;
                else
                    sounds[i].loop = false;
            }

            // load tickers
            tmp = getIniValue("General", "tickers");
            string[] tickersnames;
            if (tmp != "0")
            {
                tickersnames = tmp.Split(',');
                tickers = new TickerProperties[tickersnames.Length];
            }
            else
            {
                tickers = new TickerProperties[0];
                tickersnames = new string[0];
            }

            for (int i = 0; i < tickersnames.Length; i++)
            {
                tickers[i].name = tickersnames[i];
                tickers[i].width = Int32.Parse(getIniValue("Ticker-" + tickersnames[i], "width"));
                tickers[i].height = Int32.Parse(getIniValue("Ticker-" + tickersnames[i], "height"));
                tickers[i].left = Int32.Parse(getIniValue("Ticker-" + tickersnames[i], "left"));
                tickers[i].top = Int32.Parse(getIniValue("Ticker-" + tickersnames[i], "top"));
                tickers[i].zIndex = Int32.Parse(getIniValue("Ticker-" + tickersnames[i], "zIndex"));
                tickers[i].dataset = (DataSets)Enum.Parse(typeof(DataSets), getIniValue("Ticker-" + tickersnames[i], "dataset"));

                if (getIniValue("Ticker-" + tickersnames[i], "class") != "0")
                    tickers[i].carclass = getIniValue("Ticker-" + tickersnames[i], "class");
                else
                    tickers[i].carclass = null;

                switch (getIniValue("Ticker-" + tickersnames[i], "dataorder"))
                {
                    case "fastestlap":
                        tickers[i].dataorder = DataOrders.fastestlap;
                        break;
                    case "previouslap":
                        tickers[i].dataorder = DataOrders.previouslap;
                        break;
                    case "class":
                        tickers[i].dataorder = DataOrders.classposition;
                        break;
                    case "classposition":
                        tickers[i].dataorder = DataOrders.classposition;
                        break;
                    default:
                        tickers[i].dataorder = DataOrders.position;
                        break;
                }

                if (getIniValue("Ticker-" + tickersnames[i], "speed") != "0")
                    tickers[i].speed = Double.Parse(getIniValue("Ticker-" + tickersnames[i], "speed"));
                else
                    tickers[i].speed = 1.0;

                if (getIniValue("Ticker-" + tickersnames[i], "header") != "0")
                    tickers[i].header = loadLabelProperties("Ticker-" + tickersnames[i], getIniValue("Ticker-" + tickersnames[i], "header"));

                if (getIniValue("Ticker-" + tickersnames[i], "footer") != "0")
                    tickers[i].footer = loadLabelProperties("Ticker-" + tickersnames[i], getIniValue("Ticker-" + tickersnames[i], "footer"));

                if (getIniValue("Ticker-" + tickersnames[i], "fillvertical") == "true")
                    tickers[i].fillVertical = true;
                else
                    tickers[i].fillVertical = false;

                if (getIniValue("Ticker-" + tickersnames[i], "fixed") == "true")
                    tickers[i].presistent = true;
                else
                    tickers[i].presistent = false;

                if (getIniValue("Ticker-" + tickersnames[i], "leader") != "0")
                    tickers[i].leadervalue = getIniValue("Ticker-" + overlays[i], "leader");
                else
                    tickers[i].leadervalue = null;

                // load labels
                tmp = getIniValue("Ticker-" + tickersnames[i], "labels");
                string[] labels = tmp.Split(',');
                tickers[i].labels = new LabelProperties[labels.Length];
                for (int j = 0; j < labels.Length; j++)
                    tickers[i].labels[j] = loadLabelProperties("Ticker-" + tickersnames[i], labels[j]);

                tickers[i].visible = false;
            }


            // load buttons
            tmp = getIniValue("General", "buttons");
            string[] btns = tmp.Split(',');
           
            ButtonProperties[] tmpButtons = new ButtonProperties[btns.Length];
            for (int i = 0; i < btns.Length; i++)
            {
                tmpButtons[i].name = btns[i];
                tmpButtons[i].text = getIniValue("Button-" + btns[i], "text");
                tmpButtons[i].row = Int32.Parse(getIniValue("Button-" + btns[i], "row"));
                tmpButtons[i].delay = Int32.Parse(getIniValue("Button-" + btns[i], "delay"));
                tmpButtons[i].order = Int32.Parse(getIniValue("Button-" + btns[i], "order"));
                tmpButtons[i].active = false;
                tmpButtons[i].pressed = DateTime.Now;

                if (getIniValue("Button-" + btns[i], "loop") == "true")
                    tmpButtons[i].delayLoop = true;
                else
                    tmpButtons[i].delayLoop = false;

                if (getIniValue("Button-" + btns[i], "hidden") == "true")
                    tmpButtons[i].hidden = true;
                else
                    tmpButtons[i].hidden = false;

                // hotkey
                string hotkey = settings.getValue("Button-" + btns[i], "hotkey", false, String.Empty, false);
                if (hotkey.Length > 0)
                {
                    tmpButtons[i].hotkey = new HotKeyProperties();
                    tmpButtons[i].hotkey.key = new Key();
                    tmpButtons[i].hotkey.modifier = new KeyModifier();

                    string[] hotkeys = hotkey.Split('-');
                    tmpButtons[i].hotkey.key = (Key)Enum.Parse(typeof(Key), hotkeys[hotkeys.Length - 1]);
                    tmpButtons[i].hotkey.modifier = KeyModifier.None;

                    if (hotkeys.Length > 1)
                    {
                        for (int j = 0; j < hotkeys.Length - 1; j++)
                        {
                            tmpButtons[i].hotkey.modifier |= (KeyModifier)Enum.Parse(typeof(KeyModifier), hotkeys[j]);
                        }
                    }
                }

                // actions
                tmpButtons[i].actions = new string[Enum.GetValues(typeof(ButtonActions)).Length][];
                foreach (ButtonActions action in Enum.GetValues(typeof(ButtonActions)))
                {
                    tmp = getIniValue("Button-" + btns[i], action.ToString());
                    if (tmp != "0")
                    {
                        string[] objs = tmp.Split(',');

                        tmpButtons[i].actions[(int)action] = new string[objs.Length];
                        for (int j = 0; j < objs.Length; j++)
                        {
                            tmpButtons[i].actions[(int)action][j] = objs[j];
                        }
                    }
                    else if (action == ButtonActions.replay)
                    {
                        string value = settings.getValue("Button-" + btns[i], "replay", false, String.Empty, false);
                        if (value.Length > 0)
                        {
                            tmpButtons[i].actions[(int)action] = new string[1];
                            tmpButtons[i].actions[(int)action][0] = value;
                        }
                    }
                    else
                    {
                        tmpButtons[i].actions[(int)action] = null;
                    }
                }
            }

            // Sort and order buttons for display nicely
            buttons = new ButtonProperties[btns.Length];
            int btnPos = 0;
            foreach (var currentButton in tmpButtons.OrderBy(b => b.row).ThenBy(b => b.order))
            {
#if DEBUG
                logger.Debug("{0},{1} {2}", currentButton.row, currentButton.order, currentButton.text);
#endif
                buttons[btnPos] = currentButton;
                btnPos++;
            }
            
            // load triggers
            triggers = new TriggerProperties[Enum.GetValues(typeof(TriggerTypes)).Length];
            int trigidx = 0;
            foreach (TriggerTypes trigger in Enum.GetValues(typeof(TriggerTypes)))
            {

                foreach (ThemeTypes type in Enum.GetValues(typeof(ThemeTypes)))
                {
                    triggers[trigidx].name = trigger.ToString();
                    triggers[trigidx].actions = new string[Enum.GetValues(typeof(ButtonActions)).Length][];

                    foreach (ButtonActions action in Enum.GetValues(typeof(ButtonActions)))
                    {
                        tmp = getIniValue("Trigger-" + trigger.ToString(), action.ToString());
                        if (tmp != "0")
                        {
                            string[] objs = tmp.Split(',');

                            triggers[trigidx].actions[(int)action] = new string[objs.Length];
                            for (int j = 0; j < objs.Length; j++)
                            {
                                triggers[trigidx].actions[(int)action][j] = objs[j];
                            }
                        }
                        else if (action == ButtonActions.replay)
                        {
                            string value = settings.getValue("Button-" + trigger.ToString(), "replay",false,String.Empty,false);
                            if (value.Length > 0)
                            {
                                triggers[trigidx].actions[(int)action] = new string[1];
                                triggers[trigidx].actions[(int)action][0] = value;
                            }
                        }
                        else
                        {
                            triggers[trigidx].actions[(int)action] = null;
                        }
                    }
                }
                trigidx++;
            }

            SharedData.refreshButtons = true;

            string[] translations = new string[20] { // default translations
                    "lap",
                    "laps",
                    "minutes",
                    "of",
                    "race",
                    "qualify",
                    "practice",
                    "out",
                    "remaining",
                    "gridding",
                    "pacelap",
                    "finallap",
                    "finishing",
                    "leader",
                    "invalid",
                    "replay",
                    "Clear",
                    "Partly Cloudy",
                    "Mostly Cloudy",
                    "Overcast"
            };

            foreach (string word in translations)
            {
                string translatedword = getIniValue("Translation", word);
                if(translatedword == "0") // default is the name of the property
                    translation.Add(word, word);
                else
                    translation.Add(word, translatedword);
            }

            // signs
            if (getIniValue("General", "switchsign") == "true")
            {
                translation.Add("ahead", "+");
                translation.Add("behind", "-");
            }
            else
            {
                translation.Add("ahead", "-");
                translation.Add("behind", "+");
            }

            // load scripts
            SharedData.scripting = new Scripting();
            tmp = getIniValue("General", "scripts");
            string[] scripts = tmp.Split(',');
            for (int i = 0; i < scripts.Length; i++)
            {
                if (File.Exists(Directory.GetCurrentDirectory() + "\\" + path + "\\scripts\\" + scripts[i] + ".cs"))
                    SharedData.scripting.loadScript(Directory.GetCurrentDirectory() + "\\" + path + "\\scripts\\" + scripts[i] + ".cs");
                else if (File.Exists(Directory.GetCurrentDirectory() + "\\scripts\\" + scripts[i] + ".cs"))
                    SharedData.scripting.loadScript(Directory.GetCurrentDirectory() + "\\scripts\\" + scripts[i] + ".cs");
                else
                {
                    IScript myScript = System.Reflection.Assembly.GetExecutingAssembly().CreateInstance(scripts[i]) as IScript;
                    if (myScript != null)
                        SharedData.scripting.addScript(myScript);
                    else
                        Console.WriteLine("Script " + scripts[i] + ".cs not found!");
                }
            }
        }