public List <FieldDate> fields;       //田地

    public void AddFields(PlantControl plantControl)
    {
        FieldDate field = Instantiate(FieldPrefab, Vector3.zero, FieldPrefab.transform.rotation).GetComponent <FieldDate> (); //实例化,用于诗句持久化

        field.transform.parent = transform;                                                                                   //放置该实例化物体到管理物体下
        for (int i = 0; i < 999; i++)
        {
            if (!PlayerPrefs.HasKey("Field" + i))
            {
                field.Index = i;              //先预留一个编号
            }
        }
        field.Field                 = 0;
        field.FieldLv               = 0;
        field.FieldLvExp            = 0;
        field.FieldFertility        = 0;
        field.FieldPlantType        = 0;
        field.FieldPlantPlayer      = 0;
        field.FieldPlantLv          = 0;
        field.FieldPlantTime        = 0;
        field.FieldPlantHp          = 0;
        field.FieldPlantQuality     = 0;
        field.FieldPlantYield       = 0;
        field.FieldPlantInvestmentA = 0;
        field.FieldPlantInvestmentB = 0;
        field.FieldDiscipleNumber   = new int[6] {
            0, 0, 0, 0, 0, 0
        };
        fields.Add(field);         //加入列表内
        plantControl.fieldDate = field;
    }
Example #2
0
 /*private void LoadSeedsDate()
  * {
  *      for(int i=0;i<=999;i++)
  *      {//遍历从0-999的编号
  *              if(PlayerPrefs.HasKey("Seeds"+i))
  *              {//如果该key存在数据,则加载
  *                      seedsDateManager.CreatSeedsInstantiate(i,PlayerPrefs.GetInt("SeedsType"+i));//生成种子实例化
  *              }
  *      }
  * }*/
 private void LoadFieldsDate()
 {                                                 //加载田地数据
     for (int i = 0; i <= 999; i++)
     {                                             //遍历从0-999的编号
         if (PlayerPrefs.HasKey("Field" + i))
         {                                         //如果该key存在数据,则加载
             FieldDate newField = new FieldDate(); //new 一个用于储存数据的
             newField.Index                 = i;
             newField.Field                 = 1;
             newField.FieldLv               = PlayerPrefs.GetInt("FieldLv" + i);
             newField.FieldLvExp            = PlayerPrefs.GetInt("FieldLvExp" + i);
             newField.FieldFertility        = PlayerPrefs.GetInt("FieldFertility" + i);
             newField.FieldPlantType        = PlayerPrefs.GetInt("FieldPlantType" + i);
             newField.FieldPlantPlayer      = PlayerPrefs.GetInt("FieldPlantPlayer" + i);
             newField.FieldPlantLv          = PlayerPrefs.GetInt("FieldPlantLv" + i);
             newField.FieldPlantTime        = PlayerPrefs.GetInt("FieldPlantTime" + i);
             newField.FieldPlantHp          = PlayerPrefs.GetFloat("FieldPlantHp" + i);
             newField.FieldPlantQuality     = PlayerPrefs.GetFloat("FieldPlantQuality" + i);
             newField.FieldPlantYield       = PlayerPrefs.GetFloat("FieldPlantYield" + i);
             newField.FieldPlantInvestmentA = PlayerPrefs.GetFloat("FieldPlantInvestmentA" + i);
             newField.FieldPlantInvestmentB = PlayerPrefs.GetFloat("FieldPlantInvestmentB" + i);
             for (int j = 0; j < 6; j++)
             {                //每阶弟子的驻守数量加载
                 newField.FieldDiscipleNumber[j] = PlayerPrefs.GetInt("FieldDiscipleNumber" + i + "Lv" + j);
             }
             fieldDateManager.CreatFieldsInstantiate(newField);
         }
     }
 }
Example #3
0
//**********数据的规则

    /*灵田类0~999 最多上限一千块田地
     * 保存的内容包括,灵田的等级信息,以及灵田上种植的植物信息,进度等
     * Field+0~999  int类型 值为1  说明该田存在 值为0说明不存在(如果土地不存在则后续数据不必加载)
     * FieldLv+0~999 int类型  值为0为贫瘠的凡土、1为良田、2为肥沃土地、3为灵田
     * FieldLvExp+0~999 int类型 值为该块土地的经验值
     * FieldFertility+0~999 int类型  值为该块土地的肥力
     * FieldPlantType+0~999  int类型 值为0说明没有种植物   1为xxx植物 2为xxx植物(如果植物不存在则后续数据不必加载)
     * FieldPlantPlayer+0~999 int类型 值为驻守弟子的 编号
     * FieldPlantLv+0~999 int类型 值为当前植物的阶段
     * FieldPlantTime+0~999 int类型 值为距离下阶段的时间 1代表一个月 12代表1年 120代表十年 126代表十年六个月
     * FieldPlantHp+0~999 float类型 值为植物的生命力                    生命力=Max*值   (校验该值是否突破了上限,若突破上限则作弊)
     * FieldPlantQuality+0~999 float类型 值为植物的品质                品质=Max*值       (校验该值是否突破了上限,若突破上限则作弊)
     * FieldPlantYield+0~999 float类型 值为当前植物阶段产量         产量=Max*值      (校验该值是否突破了上限,若突破上限则作弊)
     * FieldPlantInvestmentA+0~999 float类型 值为材料A的投入     A投入=Max*值      (校验该值是否突破了上限,若突破上限则作弊)
     * FieldPlantInvestmentB+0~999 float类型 值为材料B的投入      B投入=Max*值    (校验该值是否突破了上限,若突破上限则作弊)
     *
     */
    public void SaveField(FieldDate fieldDate)
    {    //保存田地数据
        if (fieldDate.Field == 0)
        {
            PlayerPrefs.SetInt(" Field" + fieldDate.Index, 0);
        }
        else if (fieldDate.FieldPlantType == 0)
        {
            PlayerPrefs.SetInt("Field" + fieldDate.Index, 1);
            PlayerPrefs.SetInt("FieldLv" + fieldDate.Index, fieldDate.FieldLv);
            PlayerPrefs.SetInt("FieldLvExp" + fieldDate.Index, fieldDate.FieldLvExp);
            PlayerPrefs.SetInt("FieldFertility" + fieldDate.Index, fieldDate.FieldFertility);
            PlayerPrefs.SetInt("FieldPlantType" + fieldDate.Index, 0);
        }
        else
        {
            PlayerPrefs.SetInt("Field" + fieldDate.Index, 1);
            PlayerPrefs.SetInt("FieldLv" + fieldDate.Index, fieldDate.FieldLv);
            PlayerPrefs.SetInt("FieldLvExp" + fieldDate.Index, fieldDate.FieldLvExp);
            PlayerPrefs.SetInt("FieldFertility" + fieldDate.Index, fieldDate.FieldFertility);
            PlayerPrefs.SetInt("FieldPlantType" + fieldDate.Index, fieldDate.FieldPlantType);
            PlayerPrefs.SetInt("FieldPlantPlayer" + fieldDate.Index, fieldDate.FieldPlantPlayer);
            PlayerPrefs.SetInt("FieldPlantLv" + fieldDate.Index, fieldDate.FieldPlantLv);
            PlayerPrefs.SetInt("FieldPlantTime" + fieldDate.Index, fieldDate.FieldPlantTime);
            for (int j = 0; j < 6; j++)
            {            //每阶弟子的驻守数量加载
                PlayerPrefs.SetInt("FieldDiscipleNumber" + fieldDate.Index + "Lv" + j, fieldDate.FieldDiscipleNumber[j]);
            }
            PlayerPrefs.SetFloat("FieldPlantHp" + fieldDate.Index, fieldDate.FieldPlantHp);
            PlayerPrefs.SetFloat("FieldPlantQuality" + fieldDate.Index, fieldDate.FieldPlantQuality);
            PlayerPrefs.SetFloat("FieldPlantYield" + fieldDate.Index, fieldDate.FieldPlantYield);
            PlayerPrefs.SetFloat("FieldPlantInvestmentA" + fieldDate.Index, fieldDate.FieldPlantInvestmentA);
            PlayerPrefs.SetFloat("FieldPlantInvestmentB" + fieldDate.Index, fieldDate.FieldPlantInvestmentB);
        }
    }
Example #4
0
    public void LoadPlantField(FieldDate fieldDate)
    {                                                                                                                                                     //加载土地
        //***生成单一植物控制面板
        GameObject control = Instantiate(plantControlPrefab, plantControlPrefab.transform.position, plantControlPrefab.transform.rotation) as GameObject; //生成

        ControlSetting(control);
        //*** 查看某编号灵田的控制按钮
        GameObject button = Instantiate(filedButtonPrefab, Vector3.zero, filedButtonPrefab.transform.rotation) as GameObject;     //生成

        ButtonSetting(button, control);
        //****设置该块土地引用的 实例化 土地数据
        control.GetComponent <PlantControl> ().fieldDate = fieldDate;
        //******将数据应用到面板上
        ApplyUI(control);
    }
Example #5
0
 private void WriteFieldDate()
 {
     for (int i = 0; i < 5; i++)
     {                                      //创造5个数据
         FieldDate field = new FieldDate(); //实例化,用于诗句持久化
         field.Index                 = i;
         field.Field                 = 1;
         field.FieldLv               = 5;
         field.FieldLvExp            = 10;
         field.FieldFertility        = 50;
         field.FieldPlantType        = Random.Range(0, 2);
         field.FieldPlantLv          = 0;
         field.FieldPlantTime        = 2;
         field.FieldPlantHp          = 0.9f;
         field.FieldPlantQuality     = 0.9f;
         field.FieldPlantYield       = 0.9f;
         field.FieldPlantInvestmentA = 0.9f;
         field.FieldPlantInvestmentB = 0.9f;
         saveDate.SaveField(field);
     }
 }
    public void CreatFieldsInstantiate(FieldDate fieldDate)
    {                                                                                                                         //读取到数据后实例化该田地
        FieldDate field = Instantiate(FieldPrefab, Vector3.zero, FieldPrefab.transform.rotation).GetComponent <FieldDate> (); //实例化,用于诗句持久化

        field.transform.parent      = transform;                                                                              //放置该实例化物体到管理物体下
        field.Index                 = fieldDate.Index;
        field.Field                 = fieldDate.Field;
        field.FieldLv               = fieldDate.FieldLv;
        field.FieldLvExp            = fieldDate.FieldLvExp;
        field.FieldFertility        = fieldDate.FieldFertility;
        field.FieldPlantType        = fieldDate.FieldPlantType;
        field.FieldPlantPlayer      = fieldDate.FieldPlantPlayer;
        field.FieldPlantLv          = fieldDate.FieldPlantLv;
        field.FieldPlantTime        = fieldDate.FieldPlantTime;
        field.FieldPlantHp          = fieldDate.FieldPlantHp;
        field.FieldPlantQuality     = fieldDate.FieldPlantQuality;
        field.FieldPlantYield       = fieldDate.FieldPlantYield;
        field.FieldPlantInvestmentA = fieldDate.FieldPlantInvestmentA;
        field.FieldPlantInvestmentB = fieldDate.FieldPlantInvestmentB;
        System.Array.Copy(fieldDate.FieldDiscipleNumber, field.FieldDiscipleNumber, field.FieldDiscipleNumber.Length);
        fields.Add(field);         //加入列表内
        fieldUIManager.LoadPlantField(field);
    }
 protected override void WireUpFields()
 {
     UserType = new FieldString(TestFieldType.User_Type, this);
     JobStartDate = new FieldDate(TestFieldType.Job_Start_Date, this);
 }
 protected override void WireUpFields()
 {
     Start_Date = new FieldDate(TestFieldType.User_Start_Date, this);
     First_Name = new FieldString(TestFieldType.First_Name, this);
     Last_Name = new FieldString(TestFieldType.Last_Name, this);
 }
        public static void SetAdvancedComparingProperties(string dataDir)
        {
            //ExStart:SetAdvancedComparingProperties
            // Create the original document.
            Document        docOriginal = new Document();
            DocumentBuilder builder     = new DocumentBuilder(docOriginal);

            // Insert paragraph text with an endnote.
            builder.Writeln("Hello world! This is the first paragraph.");
            builder.InsertFootnote(FootnoteType.Endnote, "Original endnote text.");

            // Insert a table.
            builder.StartTable();
            builder.InsertCell();
            builder.Write("Original cell 1 text");
            builder.InsertCell();
            builder.Write("Original cell 2 text");
            builder.EndTable();

            // Insert a textbox.
            Shape textBox = builder.InsertShape(ShapeType.TextBox, 150, 20);

            builder.MoveTo(textBox.FirstParagraph);
            builder.Write("Original textbox contents");

            // Insert a DATE field.
            builder.MoveTo(docOriginal.FirstSection.Body.AppendParagraph(""));
            builder.InsertField(" DATE ");

            // Insert a comment.
            Comment newComment = new Comment(docOriginal, "John Doe", "J.D.", DateTime.Now);

            newComment.SetText("Original comment.");
            builder.CurrentParagraph.AppendChild(newComment);

            // Insert a header.
            builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
            builder.Writeln("Original header contents.");

            // Create a clone of our document, which we will edit and later compare to the original.
            Document  docEdited      = (Document)docOriginal.Clone(true);
            Paragraph firstParagraph = docEdited.FirstSection.Body.FirstParagraph;

            // Change the formatting of the first paragraph, change casing of original characters and add text.
            firstParagraph.Runs[0].Text          = "hello world! this is the first paragraph, after editing.";
            firstParagraph.ParagraphFormat.Style = docEdited.Styles[StyleIdentifier.Heading1];

            // Edit the footnote.
            Footnote footnote = (Footnote)docEdited.GetChild(NodeType.Footnote, 0, true);

            footnote.FirstParagraph.Runs[1].Text = "Edited endnote text.";

            // Edit the table.
            Table table = (Table)docEdited.GetChild(NodeType.Table, 0, true);

            table.FirstRow.Cells[1].FirstParagraph.Runs[0].Text = "Edited Cell 2 contents";

            // Edit the textbox.
            textBox = (Shape)docEdited.GetChild(NodeType.Shape, 0, true);
            textBox.FirstParagraph.Runs[0].Text = "Edited textbox contents";

            // Edit the DATE field.
            FieldDate fieldDate = (FieldDate)docEdited.Range.Fields[0];

            fieldDate.UseLunarCalendar = true;

            // Edit the comment.
            Comment comment = (Comment)docEdited.GetChild(NodeType.Comment, 0, true);

            comment.FirstParagraph.Runs[0].Text = "Edited comment.";

            // Edit the header.
            docEdited.FirstSection.HeadersFooters[HeaderFooterType.HeaderPrimary].FirstParagraph.Runs[0].Text = "Edited header contents.";

            // Apply different comparing options.
            CompareOptions compareOptions = new CompareOptions();

            compareOptions.IgnoreFormatting        = false;
            compareOptions.IgnoreCaseChanges       = false;
            compareOptions.IgnoreComments          = false;
            compareOptions.IgnoreTables            = false;
            compareOptions.IgnoreFields            = false;
            compareOptions.IgnoreFootnotes         = false;
            compareOptions.IgnoreTextboxes         = false;
            compareOptions.IgnoreHeadersAndFooters = false;
            compareOptions.Target = ComparisonTargetType.New;

            // compare both documents.
            docOriginal.Compare(docEdited, "John Doe", DateTime.Now, compareOptions);
            docOriginal.Save(dataDir + "Document.CompareOptions.docx");

            docOriginal = new Document(dataDir + "Document.CompareOptions.docx");

            // If you set compareOptions to ignore certain types of changes,
            // then revisions done on those types of nodes will not appear in the output document.
            // You can tell what kind of node a revision was done on by looking at the NodeType of the revision's parent nodes.
            Assert.AreNotEqual(compareOptions.IgnoreFormatting, docOriginal.Revisions.Any(rev => rev.RevisionType == RevisionType.FormatChange));
            Assert.AreNotEqual(compareOptions.IgnoreCaseChanges, docOriginal.Revisions.Any(s => s.ParentNode.GetText().Contains("hello")));
            Assert.AreNotEqual(compareOptions.IgnoreComments, docOriginal.Revisions.Any(rev => HasParentOfType(rev, NodeType.Comment)));
            Assert.AreNotEqual(compareOptions.IgnoreTables, docOriginal.Revisions.Any(rev => HasParentOfType(rev, NodeType.Table)));
            Assert.AreNotEqual(compareOptions.IgnoreFields, docOriginal.Revisions.Any(rev => HasParentOfType(rev, NodeType.FieldStart)));
            Assert.AreNotEqual(compareOptions.IgnoreFootnotes, docOriginal.Revisions.Any(rev => HasParentOfType(rev, NodeType.Footnote)));
            Assert.AreNotEqual(compareOptions.IgnoreTextboxes, docOriginal.Revisions.Any(rev => HasParentOfType(rev, NodeType.Shape)));
            Assert.AreNotEqual(compareOptions.IgnoreHeadersAndFooters, docOriginal.Revisions.Any(rev => HasParentOfType(rev, NodeType.HeaderFooter)));
            //ExEnd:SetAdvancedComparingProperties
        }