예제 #1
0
        internal IEnumerator <object> UpdateDo()
        {
            yield return(new WaitForSeconds(0.05f));

            ActionStatus.text = ActionQueue.instance.current == null ? "" : $"{ActionQueue.instance.current.GetType()}";
            ToolStatus.text   = $"{MoveItTool.ToolState} ({MoveItTool.MT_Tool}.{MoveItTool.AlignToolPhase}), POProc:{MoveItTool.POProcessing}";

            SelectedLarge.text = $"Objects Selected: {Action.selection.Count}";
            ushort[] types = new ushort[8];
            foreach (Instance instance in Action.selection)
            {
                if (instance is MoveableBuilding)
                {
                    types[0]++;
                }
                else if (instance is MoveableProp)
                {
                    PropInfo info = (PropInfo)PropLayer.Manager.GetInfo(instance.id).Prefab;
                    if (info.m_isDecal)
                    {
                        types[2]++;
                    }
                    else if (Filters.IsSurface(info))
                    {
                        types[3]++;
                    }
                    else
                    {
                        types[1]++;
                    }
                }
                else if (instance is MoveableTree)
                {
                    types[4]++;
                }
                else if (instance is MoveableProc)
                {
                    types[5]++;
                }
                else if (instance is MoveableNode)
                {
                    types[6]++;
                }
                else if (instance is MoveableSegment)
                {
                    types[7]++;
                }
                else
                {
                    throw new Exception($"Instance is invalid type (<{instance.GetType()}>)");
                }
            }
            SelectedSmall.text = $"B:{types[0]}, P:{types[1]}, D:{types[2]}, S:{types[3]}, T:{types[4]}, PO:{types[5]}, N:{types[6]}, S:{types[7]}\n ";

            // End with updating the hovered item
            if (id == null)
            {
                yield break;
            }
            if (id == InstanceID.Empty)
            {
                lastId = id;
                HoverLarge.textColor = new Color32(255, 255, 255, 255);
                yield break;
            }
            if (lastId == id)
            {
                yield break;
            }

            HoverLarge.textColor = new Color32(127, 217, 255, 255);
            HoverLarge.text      = "";
            HoverSmall.text      = "";

            if (id.Building > 0)
            {
                BuildingInfo info = BuildingManager.instance.m_buildings.m_buffer[id.Building].Info;
                HoverLarge.text    = $"B:{id.Building}  {info.name}";
                HoverLarge.tooltip = info.name;
                HoverSmall.text    = $"{info.GetType()} ({info.GetAI().GetType()})\n{info.m_class.name}\n({info.m_class.m_service}.{info.m_class.m_subService})";
            }
            else if (id.Prop > 0)
            {
                string   type = "P";
                PropInfo info = (PropInfo)PropLayer.Manager.GetInfo(id).Prefab;
                if (info.m_isDecal)
                {
                    type = "D";
                }
                HoverLarge.text    = $"{type}:{PropLayer.Manager.GetId(id)}  {info.name}";
                HoverLarge.tooltip = info.name;
                HoverSmall.text    = $"{info.GetType()}\n{info.m_class.name}";
            }
            else if (id.NetLane > 0)
            {
                IInfo info = MoveItTool.PO.GetProcObj(id.NetLane).Info;
                HoverLarge.text    = $"PO:{id.NetLane}  {info.Name}";
                HoverLarge.tooltip = info.Name;
                HoverSmall.text    = $"\n";
            }
            else if (id.Tree > 0)
            {
                TreeInfo info = TreeManager.instance.m_trees.m_buffer[id.Tree].Info;
                HoverLarge.text    = $"T:{id.Tree}  {info.name}";
                HoverLarge.tooltip = info.name;
                HoverSmall.text    = $"{info.GetType()}\n{info.m_class.name}";
            }
            else if (id.NetNode > 0)
            {
                NetInfo info = NetManager.instance.m_nodes.m_buffer[id.NetNode].Info;
                HoverLarge.text    = $"N:{id.NetNode}  {info.name}";
                HoverLarge.tooltip = info.name;
                HoverSmall.text    = $"{info.GetType()} ({info.GetAI().GetType()})\n{info.m_class.name}";
            }
            else if (id.NetSegment > 0)
            {
                NetInfo info = NetManager.instance.m_segments.m_buffer[id.NetSegment].Info;
                HoverLarge.text    = $"S:{id.NetSegment}  {info.name}";
                HoverLarge.tooltip = info.name;
                HoverSmall.text    = $"{info.GetType()} ({info.GetAI().GetType()})\n{info.m_class.name}";
            }

            lastId = id;
        }
예제 #2
0
        internal void Update()
        {
            if (!MoveItTool.showDebugPanel)
            {
                return;
            }

            ToolStatus.text = $"{MoveItTool.instance.ToolState} (align:{MoveItTool.instance.AlignMode}.{MoveItTool.instance.AlignToolPhase})";

            SelectedLarge.text = $"Objects Selected: {Action.selection.Count}";
            ushort[] types = new ushort[8];
            foreach (Instance instance in Action.selection)
            {
                if (instance is MoveableBuilding)
                {
                    types[0]++;
                }
                else if (instance is MoveableProp)
                {
                    PropInfo info = PropManager.instance.m_props.m_buffer[instance.id.Prop].Info;
                    if (info.m_isDecal)
                    {
                        types[2]++;
                    }
                    else if (Filters.IsSurface(info))
                    {
                        types[3]++;
                    }
                    else
                    {
                        types[1]++;
                    }
                }
                else if (instance is MoveableTree)
                {
                    types[4]++;
                }
                else if (instance is MoveableProc)
                {
                    types[5]++;
                }
                else if (instance is MoveableNode)
                {
                    types[6]++;
                }
                else if (instance is MoveableSegment)
                {
                    types[7]++;
                }
                else
                {
                    throw new Exception($"Instance is invalid type (<{instance.GetType()}>)");
                }
            }
            SelectedSmall.text = $"B:{types[0]}, P:{types[1]}, D:{types[2]}, S:{types[3]}, T:{types[4]}, PO:{types[5]}, N:{types[6]}, S:{types[7]}\n ";

            // End with updating the hovered item
            if (id == null)
            {
                return;
            }
            if (id == InstanceID.Empty)
            {
                lastId = id;
                HoverLarge.textColor = new Color32(255, 255, 255, 255);
                return;
            }
            if (lastId == id)
            {
                return;
            }

            HoverLarge.textColor = new Color32(127, 217, 255, 255);
            HoverLarge.text      = "";
            HoverSmall.text      = "";

            if (id.Building > 0)
            {
                BuildingInfo info = BuildingManager.instance.m_buildings.m_buffer[id.Building].Info;
                HoverLarge.text = $"B:{id.Building}  {info.name}";
                HoverSmall.text = $"{info.GetType()} ({info.GetAI().GetType()})\n{info.m_class.name}\n({info.m_class.m_service}.{info.m_class.m_subService})";
            }
            else if (id.Prop > 0)
            {
                string   type = "P";
                PropInfo info = PropManager.instance.m_props.m_buffer[id.Prop].Info;
                if (info.m_isDecal)
                {
                    type = "D";
                }
                HoverLarge.text = $"{type}:{id.Prop}  {info.name}";
                HoverSmall.text = $"{info.GetType()}\n{info.m_class.name}";
            }
            else if (id.NetLane > 0)
            {
                IInfo info = MoveItTool.PO.GetProcObj(id.NetLane).Info;
                HoverLarge.text = $"{id.NetLane}: {info.Name}";
                HoverSmall.text = $"\n";
            }
            else if (id.Tree > 0)
            {
                TreeInfo info = TreeManager.instance.m_trees.m_buffer[id.Tree].Info;
                HoverLarge.text = $"T:{id.Tree}  {info.name}";
                HoverSmall.text = $"{info.GetType()}\n{info.m_class.name}";
            }
            else if (id.NetNode > 0)
            {
                NetInfo info = NetManager.instance.m_nodes.m_buffer[id.NetNode].Info;
                HoverLarge.text = $"N:{id.NetNode}  {info.name}";
                HoverSmall.text = $"{info.GetType()} ({info.GetAI().GetType()})\n{info.m_class.name}";
            }
            else if (id.NetSegment > 0)
            {
                NetInfo info = NetManager.instance.m_segments.m_buffer[id.NetSegment].Info;
                HoverLarge.text = $"S:{id.NetSegment}  {info.name}";
                HoverSmall.text = $"{info.GetType()} ({info.GetAI().GetType()})\n{info.m_class.name}";
            }

            lastId = id;
        }