当前位置: 首页>>代码示例>>C#>>正文


C# Components.GetType方法代码示例

本文整理汇总了C#中Components.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Components.GetType方法的具体用法?C# Components.GetType怎么用?C# Components.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Components的用法示例。


在下文中一共展示了Components.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GlobalEvents_onComponentRemovedByPlayer

 void GlobalEvents_onComponentRemovedByPlayer(Components.Component sender)
 {
     if (sender is Components.Joint) return;
     for (int i = 0; i < components.Count; i++)
     {
         if (components[i].objType == sender.GetType() && components[i].Avalable > -1)
         {
             components[i].Avalable++;
         }
     }
 }
开发者ID:XZelnar,项目名称:MicroWorld,代码行数:11,代码来源:ComponentSelector.cs

示例2: RegisterComponent

        public void RegisterComponent(Components.Component comp)
        {
            CSComponent c = new CSComponent();

            IO.Log.Write("            Adding " + comp.Graphics.GetCSToolTip() + " to ComponentSelector");
            c.Texture = ResourceManager.Load<Texture2D>(comp.Graphics.GetIconName());
            c.objType = comp.GetType();
            c.instance = comp;
            c.componentGraphics = comp.Graphics;
            c.jointCoords0cw = comp.GetJointCoords(Components.Component.Rotation.cw0);
            c.jointCoords90cw = comp.GetJointCoords(Components.Component.Rotation.cw90);
            c.jointCoords180cw = comp.GetJointCoords(Components.Component.Rotation.cw180);
            c.jointCoords270cw = comp.GetJointCoords(Components.Component.Rotation.cw270);
            c.Name = comp.Graphics.GetCSToolTip();
            c.IsDragDropPlacement = (comp is Components.Properties.IDragDropPlacable);

            /*
            if (c.jointCoords0cw.Length % 2 == 1)
                c.jointCoords0cw = new int[0];
            else
                for (int i = 0; i < c.jointCoords0cw.Length; i++)
                    c.jointCoords0cw[i] = c.jointCoords0cw[i] - Math.Abs(c.jointCoords0cw[i] % 8);

            if (c.jointCoords90cw.Length % 2 == 1)
                c.jointCoords90cw = new int[0];
            else
                for (int i = 0; i < c.jointCoords90cw.Length; i++)
                    c.jointCoords90cw[i] = c.jointCoords90cw[i] - Math.Abs(c.jointCoords90cw[i] % 8);

            if (c.jointCoords180cw.Length % 2 == 1)
                c.jointCoords180cw = new int[0];
            else
                for (int i = 0; i < c.jointCoords180cw.Length; i++)
                    c.jointCoords180cw[i] = c.jointCoords180cw[i] - Math.Abs(c.jointCoords180cw[i] % 8);

            if (c.jointCoords270cw.Length % 2 == 1)
                c.jointCoords270cw = new int[0];
            else
                for (int i = 0; i < c.jointCoords270cw.Length; i++)
                    c.jointCoords270cw[i] = c.jointCoords270cw[i] - Math.Abs(c.jointCoords270cw[i] % 8);//*/

            //comp.typeID = (short)components.Count;
            Components.ComponentsManager.TypeIDs.Add(comp.GetType(), (short)Components.ComponentsManager.TypeIDs.Count);
            components.Add(c);
        }
开发者ID:XZelnar,项目名称:MicroWorld,代码行数:45,代码来源:ComponentSelector.cs


注:本文中的Components.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。