Example #1
0
 private void ItemManager_RefreshLegacyChestData_1(On.ItemManager.orig_RefreshLegacyChestData_1 orig, ItemManager self, ItemContainer chest)
 {
     try
     {
         if (chest != null)
         {
             OLogger.Log(chest.Name + ": " + chest.ItemCount);
         }
         //orig(self, chest);
         if (chest.ItemCount <= 0)
         {
             return;
         }
         Item item = null;
         item = chest.GetContainedItems()[0];
         if ((bool)item)
         {
             if (!m_legacyChestData.ContainsKey(chest.UID))
             {
                 m_legacyChestData.Add(chest.UID, new LegacyChestDataMod(chest));
             }
             m_legacyChestData[chest.UID].SetContainedData(item, chest.GetContainedItems().Count);
         }
     }
     catch (Exception ex)
     {
         OLogger.Error($"RefreshLegacyChestData={ex.Message}");
     }
 }
Example #2
0
        private void AddServerFrame(FSPFrame frame)
        {
            if (frame.frameId <= 0)
            {
                ExecuteFrame(frame.frameId, frame);
                return;
            }

            frame.frameId      = frame.frameId * mParam.clientFrameRateMultiple;
            mClientLockedFrame = frame.frameId + mParam.clientFrameRateMultiple - 1;

            mFrameBuffer.Add(frame.frameId, frame);
            mFrameCtrl.AddFrameId(frame.frameId);
        }
Example #3
0
        public IConnection CreateConnection(uint connId, Type type, string ip, int port)
        {
            IConnection conn = type.Assembly.CreateInstance(type.FullName) as IConnection;

            m_mapConnection.Add(connId, conn);
            conn.Connect(ip, port);
            return(conn);
        }
Example #4
0
        public Color GetUniqueColor(int colorId)
        {
            if (m_mapColor.ContainsKey(colorId))
            {
                return(m_mapColor[colorId]);
            }

            Color c = new Color(random.Rnd(), random.Rnd(), random.Rnd());

            m_mapColor.Add(colorId, c);
            return(c);
        }
Example #5
0
        public void Push(IRecyclableObject obj)
        {
            string type = obj.GetRecycleType();
            Stack <IRecyclableObject> stackIdleObject = idleObjectList[type];

            if (stackIdleObject == null)
            {
                stackIdleObject = new Stack <IRecyclableObject>();
                idleObjectList.Add(type, stackIdleObject);
            }
            stackIdleObject.Push(obj);
        }
Example #6
0
            public static void InitMappings(ControlMappingPanel __instance, ControlMappingSection ___m_sectionTemplate,
                                            DictionaryExt <int, ControlMappingSection> ___m_sectionList, Controller ___m_lastJoystickController)
            {
                // filter our custom keybindings for this context
                var filter = s_customKeyDict.Values
                             .Where(it => it.category == CUSTOM_CATEGORY &&
                                    (it.controllerType == ControlType.Both || (int)it.controllerType == (int)__instance.ControllerType));

                // check if any keybindings in "custom" category were defined
                if (!filter.Any())
                {
                    return;
                }

                // set up our custom localization (if not already)
                InitLocalization();

                // set the template active while we clone from it
                ___m_sectionTemplate.gameObject.SetActive(true);
                // Create the UI (copied from how game does it)
                var mapSection = UnityEngine.Object.Instantiate(___m_sectionTemplate, ___m_sectionTemplate.transform.parent);

                // set the template inactive again
                ___m_sectionTemplate.gameObject.SetActive(false);

                // move our custom section to the top
                mapSection.transform.SetAsFirstSibling();

                // Setup our custom map section
                ___m_sectionList.Add(CUSTOM_CATEGORY, mapSection);
                mapSection.ControllerType = __instance.ControllerType;
                mapSection.SetCategory(CUSTOM_CATEGORY);

                // Init the custom keys
                if (__instance.ControllerType == ControlMappingPanel.ControlType.Keyboard)
                {
                    var kbMap = ReInput.mapping.GetKeyboardMapInstance(CUSTOM_CATEGORY, 0);
                    InitCustomSection(mapSection, kbMap, filter);

                    var mouseMap = ReInput.mapping.GetMouseMapInstance(CUSTOM_CATEGORY, 0);
                    InitCustomSection(mapSection, mouseMap, filter);
                }
                else
                {
                    var joyMap = ReInput.mapping.GetJoystickMapInstance(___m_lastJoystickController as Joystick, CUSTOM_CATEGORY, 0);
                    InitCustomSection(mapSection, joyMap, filter);
                }
            }