Exemple #1
0
        public override void RenderOverlay(RenderManager.CameraInfo cameraInfo, Color toolColor, Color despawnColor)
        {
            if (!isValid)
            {
                return;
            }

            uint        tree        = id.Tree;
            TreeManager treeManager = TreeManager.instance;
            TreeInfo    treeInfo    = treeManager.m_trees.m_buffer[tree].Info;
            Vector3     position    = treeManager.m_trees.m_buffer[tree].Position;
            Randomizer  randomizer  = new Randomizer(tree);
            float       scale       = treeInfo.m_minScale + (float)randomizer.Int32(10000u) * (treeInfo.m_maxScale - treeInfo.m_minScale) * 0.0001f;
            float       alpha       = 1f;

            TreeTool.CheckOverlayAlpha(treeInfo, scale, ref alpha);
            toolColor.a *= alpha;
            TreeTool.RenderOverlay(cameraInfo, treeInfo, position, scale, toolColor);
        }
Exemple #2
0
        public override void RenderOverlay(RenderManager.CameraInfo cameraInfo)
        {
            if (this.m_toolController.IsInsideUI || !Cursor.visible)
            {
                base.RenderOverlay(cameraInfo);
                return;
            }
            switch (HoverInstance.Type)
            {
            case InstanceType.Building:
            {
                ushort          building   = HoverInstance.Building;
                NetManager      instance   = Singleton <NetManager> .instance;
                BuildingManager instance2  = Singleton <BuildingManager> .instance;
                BuildingInfo    info5      = instance2.m_buildings.m_buffer[(int)building].Info;
                Color           toolColor6 = GetOverlayColor();
                float           num        = 1f;
                BuildingTool.CheckOverlayAlpha(info5, ref num);
                ushort num2 = instance2.m_buildings.m_buffer[(int)building].m_netNode;
                int    num3 = 0;
                while (num2 != 0)
                {
                    for (int j = 0; j < 8; j++)
                    {
                        ushort segment = instance.m_nodes.m_buffer[(int)num2].GetSegment(j);
                        if (segment != 0 && instance.m_segments.m_buffer[(int)segment].m_startNode == num2 && (instance.m_segments.m_buffer[(int)segment].m_flags & NetSegment.Flags.Untouchable) != NetSegment.Flags.None)
                        {
                            NetTool.CheckOverlayAlpha(ref instance.m_segments.m_buffer[(int)segment], ref num);
                        }
                    }
                    num2 = instance.m_nodes.m_buffer[(int)num2].m_nextBuildingNode;
                    if (++num3 > 32768)
                    {
                        CODebugBase <LogChannel> .Error(LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace);

                        break;
                    }
                }
                ushort subBuilding = instance2.m_buildings.m_buffer[(int)building].m_subBuilding;
                num3 = 0;
                while (subBuilding != 0)
                {
                    BuildingTool.CheckOverlayAlpha(instance2.m_buildings.m_buffer[(int)subBuilding].Info, ref num);
                    subBuilding = instance2.m_buildings.m_buffer[(int)subBuilding].m_subBuilding;
                    if (++num3 > 49152)
                    {
                        CODebugBase <LogChannel> .Error(LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace);

                        break;
                    }
                }
                toolColor6.a *= num;
                int     length    = instance2.m_buildings.m_buffer[(int)building].Length;
                Vector3 position2 = instance2.m_buildings.m_buffer[(int)building].m_position;
                float   angle2    = instance2.m_buildings.m_buffer[(int)building].m_angle;
                BuildingTool.RenderOverlay(cameraInfo, info5, length, position2, angle2, toolColor6, false);
                num2 = instance2.m_buildings.m_buffer[(int)building].m_netNode;
                num3 = 0;
                while (num2 != 0)
                {
                    for (int k = 0; k < 8; k++)
                    {
                        ushort segment2 = instance.m_nodes.m_buffer[(int)num2].GetSegment(k);
                        if (segment2 != 0 && instance.m_segments.m_buffer[(int)segment2].m_startNode == num2 && (instance.m_segments.m_buffer[(int)segment2].m_flags & NetSegment.Flags.Untouchable) != NetSegment.Flags.None)
                        {
                            NetTool.RenderOverlay(cameraInfo, ref instance.m_segments.m_buffer[(int)segment2], toolColor6, toolColor6);
                        }
                    }
                    num2 = instance.m_nodes.m_buffer[(int)num2].m_nextBuildingNode;
                    if (++num3 > 32768)
                    {
                        CODebugBase <LogChannel> .Error(LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace);

                        break;
                    }
                }
                subBuilding = instance2.m_buildings.m_buffer[(int)building].m_subBuilding;
                num3        = 0;
                while (subBuilding != 0)
                {
                    BuildingInfo info6     = instance2.m_buildings.m_buffer[(int)subBuilding].Info;
                    int          length2   = instance2.m_buildings.m_buffer[(int)subBuilding].Length;
                    Vector3      position3 = instance2.m_buildings.m_buffer[(int)subBuilding].m_position;
                    float        angle3    = instance2.m_buildings.m_buffer[(int)subBuilding].m_angle;
                    BuildingTool.RenderOverlay(cameraInfo, info6, length2, position3, angle3, toolColor6, false);
                    subBuilding = instance2.m_buildings.m_buffer[(int)subBuilding].m_subBuilding;
                    if (++num3 > 49152)
                    {
                        CODebugBase <LogChannel> .Error(LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace);

                        break;
                    }
                }
                break;
            }

            case InstanceType.Tree:
            {
                uint        tree        = HoverInstance.Tree;
                TreeManager instance11  = Singleton <TreeManager> .instance;
                TreeInfo    info9       = instance11.m_trees.m_buffer[(int)((UIntPtr)tree)].Info;
                Vector3     position6   = instance11.m_trees.m_buffer[(int)((UIntPtr)tree)].Position;
                Randomizer  randomizer4 = new Randomizer(tree);
                float       scale4      = info9.m_minScale + (float)randomizer4.Int32(10000u) * (info9.m_maxScale - info9.m_minScale) * 0.0001f;
                Color       toolColor13 = GetOverlayColor();
                float       num13       = 1f;
                TreeTool.CheckOverlayAlpha(info9, scale4, ref num13);
                toolColor13.a *= num13;
                TreeTool.RenderOverlay(cameraInfo, info9, position6, scale4, toolColor13);
                break;
            }
            }
            base.RenderOverlay(cameraInfo);
        }