Beispiel #1
0
        public void SaveEncryptedData()
        {
            string playerFile = Path.Combine(Location, "player.salakieli");

            if (File.Exists(playerFile))
            {
                string      contents = GameSaveCrypto.Decrypt(playerFile);
                XmlDocument xmlDoc   = new XmlDocument();
                xmlDoc.LoadXml(contents);

                XmlNode transformNode = xmlDoc.SelectSingleNode("//Entity/_Transform");
                transformNode.Attributes["position.x"].Value = PositionX.ToString();
                transformNode.Attributes["position.y"].Value = PositionY.ToString();

                XmlNode damageNode = xmlDoc.SelectSingleNode("//Entity/DamageModelComponent");
                damageNode.Attributes["hp"].Value     = (HP / 25f).ToString();
                damageNode.Attributes["max_hp"].Value = (MaxHP / 25f).ToString();

                XmlNode walletNode = xmlDoc.SelectSingleNode("//Entity/WalletComponent");
                walletNode.Attributes["money"].Value = Money.ToString();

                XmlNode gameLogNode = xmlDoc.SelectSingleNode("//Entity/GameLogComponent");
                gameLogNode.Attributes["report_damage"].Value = ReportDamage ? "1" : "0";

                using (var stringWriter = new StringWriter())
                    using (var xmlTextWriter = XmlWriter.Create(stringWriter))
                    {
                        xmlDoc.WriteTo(xmlTextWriter);
                        xmlTextWriter.Flush();
                        GameSaveCrypto.Encrypt(playerFile, stringWriter.GetStringBuilder().ToString());
                    }
            }
        }
 private void DebugLogs()
 {
     Debug.Log("X:" + PositionX.ToString() + " " + "Y:" + PositionY.ToString());
     Debug.Log("Stan: " + state);
     Debug.Log("Czas: " + Math.Round(Time.time, 2) + "s");
     Debug.Log("Odleglosc do celu: " + DistanceToObstacleX + "," + DistanceToObstacleY);
 }
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Door", true, out subEle);
            Door.WriteXML(subEle, master);

            ele.TryPathTo("Position/X", true, out subEle);
            subEle.Value = PositionX.ToString("G15");

            ele.TryPathTo("Position/Y", true, out subEle);
            subEle.Value = PositionY.ToString("G15");

            ele.TryPathTo("Position/Z", true, out subEle);
            subEle.Value = PositionZ.ToString("G15");

            ele.TryPathTo("Rotation/X", true, out subEle);
            subEle.Value = RotationX.ToString("G15");

            ele.TryPathTo("Rotation/Y", true, out subEle);
            subEle.Value = RotationY.ToString("G15");

            ele.TryPathTo("Rotation/Z", true, out subEle);
            subEle.Value = RotationZ.ToString("G15");

            ele.TryPathTo("Alarm", true, out subEle);
            subEle.Value = Alarm.ToString();
        }
        public void WriteXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Position/X", true, out subEle);
            subEle.Value = PositionX.ToString("G15");

            ele.TryPathTo("Position/Y", true, out subEle);
            subEle.Value = PositionY.ToString("G15");

            ele.TryPathTo("Position/Z", true, out subEle);
            subEle.Value = PositionZ.ToString("G15");

            ele.TryPathTo("Rotation/X", true, out subEle);
            subEle.Value = RotationX.ToString("G15");

            ele.TryPathTo("Rotation/Y", true, out subEle);
            subEle.Value = RotationY.ToString("G15");

            ele.TryPathTo("Rotation/Z", true, out subEle);
            subEle.Value = RotationZ.ToString("G15");

            ele.TryPathTo("Scale", true, out subEle);
            subEle.Value = Scale.ToString("G15");
        }
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Width", true, out subEle);
            subEle.Value = Width.ToString("G15");

            ele.TryPathTo("Height", true, out subEle);
            subEle.Value = Height.ToString("G15");

            ele.TryPathTo("Position/X", true, out subEle);
            subEle.Value = PositionX.ToString("G15");

            ele.TryPathTo("Position/Y", true, out subEle);
            subEle.Value = PositionY.ToString("G15");

            ele.TryPathTo("Position/Z", true, out subEle);
            subEle.Value = PositionZ.ToString("G15");

            ele.TryPathTo("Rotation/Quaternion1", true, out subEle);
            subEle.Value = RotationQuaternion1.ToString("G15");

            ele.TryPathTo("Rotation/Quaternion2", true, out subEle);
            subEle.Value = RotationQuaternion2.ToString("G15");

            ele.TryPathTo("Rotation/Quaternion3", true, out subEle);
            subEle.Value = RotationQuaternion3.ToString("G15");

            ele.TryPathTo("Rotation/Quaternion4", true, out subEle);
            subEle.Value = RotationQuaternion4.ToString("G15");
        }
Beispiel #6
0
        public static string CoordinatesString()
        {
            StringBuilder sb = new StringBuilder("{");

            sb.Append(PositionX.ToString("F"));
            sb.Append(", ");
            sb.Append(PositionY.ToString("F"));
            sb.Append("}");
            return(sb.ToString());
        }
Beispiel #7
0
            internal List <Tuple <String, String> > GetAttributes()
            {
                var res = new List <Tuple <String, String> >();

                res.Add(new Tuple <String, String>("position_x", PositionX.ToString(CultureInfo.InvariantCulture)));
                res.Add(new Tuple <String, String>("position_y", PositionY.ToString(CultureInfo.InvariantCulture)));
                res.Add(new Tuple <String, String>("position_z", PositionZ.ToString(CultureInfo.InvariantCulture)));
                res.Add(new Tuple <String, String>("orientation_x", OrientationX.ToString(CultureInfo.InvariantCulture)));
                res.Add(new Tuple <String, String>("orientation_y", OrientationY.ToString(CultureInfo.InvariantCulture)));
                res.Add(new Tuple <String, String>("orientation_z", OrientationZ.ToString(CultureInfo.InvariantCulture)));
                return(res);
            }
Beispiel #8
0
        internal XmlNode GetXmlImage(XmlDocument document)
        {
            XmlNode parent = document.CreateNode(XmlNodeType.Element, "image", "");

            XmlNode id = document.CreateNode(XmlNodeType.Element, "id", "");

            id.InnerText = Id;

            XmlNode name = document.CreateNode(XmlNodeType.Element, "name", "");

            name.InnerText = ImageName;

            XmlNode path = document.CreateNode(XmlNodeType.Element, "path", "");

            path.InnerText = ImagePath.ToString();

            XmlNode width = document.CreateNode(XmlNodeType.Element, "width", "");

            width.InnerText = Width.ToString();

            XmlNode height = document.CreateNode(XmlNodeType.Element, "height", "");

            height.InnerText = Height.ToString();

            XmlNode positionX = document.CreateNode(XmlNodeType.Element, "positionX", "");

            positionX.InnerText = PositionX.ToString();

            XmlNode positionY = document.CreateNode(XmlNodeType.Element, "positionY", "");

            positionY.InnerText = PositionY.ToString();

            XmlNode row = document.CreateNode(XmlNodeType.Element, "row", "");

            row.InnerText = Row.ToString();

            XmlNode column = document.CreateNode(XmlNodeType.Element, "column", "");

            column.InnerText = Column.ToString();

            parent.AppendChild(id);
            parent.AppendChild(name);
            parent.AppendChild(path);
            parent.AppendChild(width);
            parent.AppendChild(height);
            parent.AppendChild(positionX);
            parent.AppendChild(positionY);
            parent.AppendChild(row);
            parent.AppendChild(column);

            return(parent);
        }
Beispiel #9
0
		public override string ToString() {
			return Frames.ToString().PadLeft(4, ' ') + (Jump ? ",Jump" : "") + (Save ? ",Save" : "") + (Fire ? ",Fire" : "") + (Bash ? ",Bash" : "") +
				(ChargeJump ? ",CJump" : "") + (Glide ? ",Glide" : "") + (Start ? ",Start" : "") + (Select ? ",Select" : "") + (UI ? ",UI" : "") +
				(Action ? ",Action" : "") + (Esc ? ",Esc" : "") + (Dash ? ",Dash" : "") + (Grenade ? ",Grenade" : "") +
				Axis() + (DLoad ? ",DLoad" : "") + (DSave ? ",DSave" : "") + (SaveSlot >= 0 ? ",Slot," + (SaveSlot + 1) : "") +
				(!Position ? "" : ",Pos," + PositionX.ToString("0.####") + "," + PositionY.ToString("0.####")) +
				(!Speed ? "" : ",Speed," + SpeedX.ToString("0.####") + "," + SpeedY.ToString("0.####")) +
				(XP >= 0 ? ",XP," + XP : "") + (Color ? ",Color" : "") + (Random >= 0 ? ",Random," + Random : "") +
				(!EntityPos ? "" : ",EntityPos," + EntityPosX.ToString("0.####") + "," + EntityPosY.ToString("0.####")) +
				(!BlockPos ? "" : ",BlockPos," + BlockPosX.ToString("0.####") + "," + BlockPosY.ToString("0.####")) +
				(EntityHP < 0 ? "" : ",EntityHP," + EntityHP.ToString("0.##")) + (HP >= 0 ? ",HP," + HP.ToString("0.#") : "") + (EN >= 0 ? ",EN," + EN.ToString("0.##") : "") +
				(Restore ? ",Restore" : "") + (Copy >= 0 ? ",Copy," + (Copy + 1) : "") + (SkillTree >= 0 ? ",SkillTree," + SkillTree : "") +
				(MouseX < 0 && MouseY < 0 ? "" : ",Mouse," + MouseX.ToString("0.####") + "," + MouseY.ToString("0.####"));
		}
Beispiel #10
0
 private void Grid_Loaded(object sender, RoutedEventArgs e)
 {
     txtAgvCarName.Text = AgvName;
     if (AgvSate == (byte)AgvStateInfor.Charge)
     {
         stateAgvStatus.Fill = Brushes.Green;
     }
     else if (AgvSate == (byte)AgvStateInfor.Abnormal)
     {
         stateAgvStatus.Fill = Brushes.Red;
     }
     txtAgvStatus.Text = "2";
     txtAgvTask.Text   = TriggerId.ToString() + "站台";
     txtPositionX.Text = PositionX.ToString("f3");
     txtPositionY.Text = PositionY.ToString("f3");
     txtWeight.Text    = Weight.ToString("f1") + "Kg";
 }
Beispiel #11
0
 public override string ToString()
 {
     return(PositionX.ToString() + ", " + PositionY.ToString() + ": " + MinZ.ToString() + ", " + MaxZ.ToString() + ": " + HeightmapDimX.ToString() + " x " + HeightmapDimY.ToString());
 }