Beispiel #1
0
        private void InitialiseLogic()
        {
            if (isModEnabled())
            {
                Enabled = true;

                gameObject = new GameObject("MIT_POLogic");
                gameObject.AddComponent <PO_Logic>();
                Logic = gameObject.GetComponent <PO_Logic>();
            }
            else
            {
                Enabled = false;
            }
        }
Beispiel #2
0
        internal static string getVersionText()
        {
            if (isModInstalled())
            {
                if (VersionNames.Contains(PO_Logic.getVersion().Substring(0, 3)))
                {
                    return(String.Format(Str.integration_PO_Found, PO_Logic.getVersion().Substring(0, 3)));
                }
                else
                {
                    return(String.Format(Str.integration_PO_WrongVersion, PO_Logic.getVersion().Substring(0, 3)));
                }
            }

            return(Str.integration_PO_Notfound);
        }
Beispiel #3
0
        internal static string getVersionText()
        {
            if (isModInstalled())
            {
                if (VersionNames.Contains(PO_Logic.getVersion().Substring(0, 3)))
                {
                    return($"PO version {PO_Logic.getVersion().Substring(0, 3)} found, integration enabled!\n ");
                }
                else
                {
                    return($"PO integration failed - found version {PO_Logic.getVersion().Substring(0, 3)} (required: 1.6)\n ");
                }
            }

            return("PO is not available. To use these options please quit Cities Skylines and subscribe to PO.\n ");
        }
Beispiel #4
0
 private static string _getVersion()
 {
     return(PO_Logic.getVersion());
 }
Beispiel #5
0
        /// <returns>Bool - whether any PO changed since MIT was disabled</returns>
        internal bool ToolEnabled()
        {
            Dictionary <uint, PO_Object> newVisible = new Dictionary <uint, PO_Object>();
            HashSet <uint> newIds = new HashSet <uint>();

            foreach (PO_Object obj in Logic.Objects)
            {
                newVisible.Add(obj.Id, obj);
                newIds.Add(obj.Id);
            }

            HashSet <uint> removed = new HashSet <uint>(visibleIds);

            removed.ExceptWith(newIds);
            HashSet <uint> added = new HashSet <uint>(newIds);

            added.ExceptWith(visibleIds);

            List <Instance> toRemove = new List <Instance>();

            foreach (Instance instance in Action.selection)
            {
                uint id = instance.id.NetLane;
                if (id > 0)
                {
                    if (removed.Contains(id))
                    {
                        toRemove.Add(instance);
                    }
                }
            }
            foreach (Instance instance in toRemove)
            {
                Action.selection.RemoveObject(instance);
            }

            MoveItTool.m_debugPanel.UpdatePanel();

            //Log.Debug($"Visible from:{visibleObjects.Count} to:{newVisible.Count}\nSelected from:{selectedIds.Count} to:{newSelectedIds.Count}");

            visibleObjects = newVisible;
            visibleIds     = newIds;

            try
            {
                if (PO_Logic.IsGroupFilterEnabled())
                {
                    InitGroups();
                    string msg = $"PO Groups: {Groups.Count} found\n";
                    //foreach (PO_Group g in MoveItTool.PO.Groups)
                    //{
                    //    msg += $"{g.objects.Count} ({g.root.Id}), ";
                    //}
                    //Log.Debug(msg);
                }
                else
                {
                    Log.Debug($"PO Groups disabled");
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
            }

            if (added.Count > 0 || removed.Count > 0)
            {
                return(true);
            }

            return(false);
        }