Пример #1
0
        public static void CycleQuickslotBar(Character character, bool cycleForward)
        {
            int max = cfg_NumberOfExtraBars.Value;

            //Debug.Log("Cycling QS (forward: " + cycleForward + ", max: " + max + ")");

            if (max < 1)
            {
                return;
            }

            var ext = GetOrCreateSave(character.UID);

            ext.SetDataFromCharacter(character);

            int desired = ext.ActiveBarIndex + (cycleForward ? 1 : -1);

            if (desired < 0)
            {
                desired = max;
            }
            else if (desired > max)
            {
                desired = 0;
            }

            //Debug.Log("setting desired ActiveBarIndex: " + desired);

            ext.ActiveBarIndex = desired;

            QuickslotSaveExtension.ApplySaveToCharacter(character);
        }
Пример #2
0
        public static QuickslotSaveExtension GetOrCreateSave(string characterUID)
        {
            QuickslotSaveExtension ret;

            if (!s_quickslotSaves.ContainsKey(characterUID))
            {
                s_quickslotSaves.Add(characterUID, ret = new QuickslotSaveExtension());
            }
            else if (!s_quickslotSaves.TryGetValue(characterUID, out ret))
            {
                ret = s_quickslotSaves[characterUID] = new QuickslotSaveExtension();
            }

            return(ret);
        }