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


C# GameKeepComponent.SaveIntoDatabase方法代码示例

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


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

示例1: OnCommand


//.........这里部分代码省略.........
						//component.ComponentX = (component.X - myKeep.X) / 148;
						//component.ComponentY = (component.Y - myKeep.Y) / 148;

                        double angle = myKeep.Heading * ((Math.PI * 2) / 360); // angle*2pi/360;

                        //component.ComponentX = (int)((148 * Math.Sin(angle) * myKeep.X - 148 * Math.Sin(angle) * client.Player.X + client.Player.Y - myKeep.Y)
                        //    / (148 * Math.Sin(angle) - 148 * 148 * 2 * Math.Sin(angle) * Math.Cos(angle)));
                        //component.ComponentY = (int)((myKeep.Y - client.Player.Y + 148 * Math.Sin(angle) * component.ComponentX) / (148 * Math.Cos(angle)));

                        component.ComponentX = CalcCX(client.Player, myKeep, angle);
                        component.ComponentY = CalcCY(client.Player, myKeep, angle);

						/*
						x = (component.X-myKeep.X)/148 = a*cos(t) - b*sin(t)
						y = (component.Y-myKeep.Y)/148 = a*sin(t) + b*cos(t)
						a = sqrt((x+b*sin(t))^2 + (y-b*cos(t))^2)
						a = sqrt(x²+y²+b² +2*x*b*sin(t)-2*y*b*cos(t))
						b = sqrt((x-a*cos(t))^2 + (y-a*sin(t))^2)
						b = sqrt(x²+y²+a²-2*x*a*cos(t)-2*y*a*sin(t))
						0 = 2x²+2y²-2*x*a*cos(t)-2*y*a*sin(t)+2*x*sqrt(x²+y²+a²-2*x*a*cos(t)-2*y*a*sin(t))*sin(t)-2*y*sqrt(x²+y²+a²-2*x*a*cos(t)-2*y*a*sin(t))*cos(t)
						pfff
						so must find an other way to find it....
						*/
						component.Name = myKeep.Name;
						component.Model = INVISIBLE_MODEL;
						component.Skin = skin;
						component.Level = (byte)myKeep.Level;
						component.CurrentRegion = client.Player.CurrentRegion;
						component.Health = component.MaxHealth;
						component.ID = myKeep.KeepComponents.Count;
						component.AbstractKeep.KeepComponents.Add(component);
						component.SaveInDB = true;
						component.AddToWorld();
						component.SaveIntoDatabase();
						client.Out.SendKeepInfo(myKeep);
						client.Out.SendKeepComponentInfo(component);
						client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.KeepComponents.Create.KCCreated"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
					} break;
				#endregion Create
                #region Move
                case "move":
                    {
                        GameKeepComponent component = client.Player.TargetObject as GameKeepComponent;

                        component.X = client.Player.X;
                        component.Y = client.Player.Y;
                        component.Z = client.Player.Z;
                        component.ComponentHeading = (client.Player.Heading - myKeep.Heading) / 1024;
                        component.Heading = (ushort)(component.ComponentHeading * 1024 + myKeep.Heading);
                        component.Keep = myKeep;
                        //todo good formula
                        //component.ComponentX = (component.X - myKeep.X) / 148;
                        //component.ComponentY = (myKeep.Y - component.Y) / 148;
                        double angle = myKeep.Heading * ((Math.PI * 2) / 360); // angle*2pi/360;

                        //component.ComponentX = (int)((148 * Math.Sin(angle) * myKeep.X - 148 * Math.Sin(angle) * client.Player.X + client.Player.Y - myKeep.Y)
                        //    / (148 * Math.Sin(angle) - 148 * 148 * 2 * Math.Sin(angle) * Math.Cos(angle)));
                        //component.ComponentY = (int)((myKeep.Y - client.Player.Y + 148 * Math.Sin(angle) * component.ComponentX) / (148 * Math.Cos(angle)));

                        component.ComponentX = CalcCX(client.Player, myKeep, angle);
                        component.ComponentY = CalcCY(client.Player, myKeep, angle);

                        client.Out.SendKeepInfo(myKeep);
                        client.Out.SendKeepComponentInfo(component);
						client.Out.SendKeepComponentDetailUpdate(component);
						client.Out.SendMessage("Component moved.  Use /keepcomponent save to save, or reload to reload the original position.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
开发者ID:mynew4,项目名称:DOLSharp,代码行数:67,代码来源:KeepComponent.cs

示例2: OnCommand


//.........这里部分代码省略.........
						//component.ComponentX = (component.X - myKeep.X) / 148;
						//component.ComponentY = (component.Y - myKeep.Y) / 148;

                        double angle = myKeep.Heading * ((Math.PI * 2) / 360); // angle*2pi/360;

                        //component.ComponentX = (int)((148 * Math.Sin(angle) * myKeep.X - 148 * Math.Sin(angle) * client.Player.X + client.Player.Y - myKeep.Y)
                        //    / (148 * Math.Sin(angle) - 148 * 148 * 2 * Math.Sin(angle) * Math.Cos(angle)));
                        //component.ComponentY = (int)((myKeep.Y - client.Player.Y + 148 * Math.Sin(angle) * component.ComponentX) / (148 * Math.Cos(angle)));

                        component.ComponentX = CalcCX(client.Player, myKeep, angle);
                        component.ComponentY = CalcCY(client.Player, myKeep, angle);

						/*
						x = (component.X-myKeep.X)/148 = a*cos(t) - b*sin(t)
						y = (component.Y-myKeep.Y)/148 = a*sin(t) + b*cos(t)
						a = sqrt((x+b*sin(t))^2 + (y-b*cos(t))^2)
						a = sqrt(x²+y²+b² +2*x*b*sin(t)-2*y*b*cos(t))
						b = sqrt((x-a*cos(t))^2 + (y-a*sin(t))^2)
						b = sqrt(x²+y²+a²-2*x*a*cos(t)-2*y*a*sin(t))
						0 = 2x²+2y²-2*x*a*cos(t)-2*y*a*sin(t)+2*x*sqrt(x²+y²+a²-2*x*a*cos(t)-2*y*a*sin(t))*sin(t)-2*y*sqrt(x²+y²+a²-2*x*a*cos(t)-2*y*a*sin(t))*cos(t)
						pfff
						so must find an other way to find it....
						*/
						component.Name = myKeep.Name;
						component.Model = INVISIBLE_MODEL;
						component.Skin = skin;
						component.Level = (byte)myKeep.Level;
						component.CurrentRegion = client.Player.CurrentRegion;
						component.Health = component.MaxHealth;
						component.ID = myKeep.KeepComponents.Count;
						component.Keep.KeepComponents.Add(component);
						component.SaveInDB = true;
						component.AddToWorld();
						component.SaveIntoDatabase();
						client.Out.SendKeepInfo(myKeep);
						client.Out.SendKeepComponentInfo(component);
						client.Out.SendMessage(LanguageMgr.GetTranslation(client, "GMCommands.KeepComponents.Create.KCCreated"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
					} break;
				#endregion Create
                #region Move
                case "move":
                    {
                        GameKeepComponent component = client.Player.TargetObject as GameKeepComponent;

                        component.X = client.Player.X;
                        component.Y = client.Player.Y;
                        component.Z = client.Player.Z;
                        component.ComponentHeading = (client.Player.Heading - myKeep.Heading) / 1024;
                        component.Heading = (ushort)(component.ComponentHeading * 1024 + myKeep.Heading);
                        component.Keep = myKeep;
                        //todo good formula
                        //component.ComponentX = (component.X - myKeep.X) / 148;
                        //component.ComponentY = (myKeep.Y - component.Y) / 148;
                        double angle = myKeep.Heading * ((Math.PI * 2) / 360); // angle*2pi/360;

                        //component.ComponentX = (int)((148 * Math.Sin(angle) * myKeep.X - 148 * Math.Sin(angle) * client.Player.X + client.Player.Y - myKeep.Y)
                        //    / (148 * Math.Sin(angle) - 148 * 148 * 2 * Math.Sin(angle) * Math.Cos(angle)));
                        //component.ComponentY = (int)((myKeep.Y - client.Player.Y + 148 * Math.Sin(angle) * component.ComponentX) / (148 * Math.Cos(angle)));

                        component.ComponentX = CalcCX(client.Player, myKeep, angle);
                        component.ComponentY = CalcCY(client.Player, myKeep, angle);

                        component.SaveIntoDatabase();
                        client.Out.SendKeepInfo(myKeep);
                        client.Out.SendKeepComponentInfo(component);
                        client.Out.SendMessage("Component moved.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
开发者ID:boscorillium,项目名称:dol,代码行数:67,代码来源:KeepComponent.cs


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