Esempio n. 1
0
    private void SetData()
    {
        //기본세팅
        page = 0;
        //선택지 세팅
        CodeBox.ClearList(boxTr);
        if (answerType == TalkBox.EVENT)
        {
            for (int i = 0; i < npc.have_Event.Count; i++)
            {
                int num = npc.have_Event[i];

                CodeBox.AddChildInParent(boxTr, box).GetComponent <Npc_Talk_Box>().SetBox(transform, num, NpcData.Instance.npcTalk_Event[num]);
            }
        }
        else//키워드 나열
        {
            for (int i = 0; i < NpcData.Instance.npcTalk_Keyword.Length; i++)
            {
                if (!NpcData.Instance.npcTalk_Keyword[i].unlock)
                {
                    continue;
                }
                CodeBox.AddChildInParent(boxTr, box).GetComponent <Npc_Talk_Box>().SetBox(transform, i, npc.Used_Keyword_Icon(i));
            }
        }
    }
 /// <summary>
 /// 组装读取的数据
 /// </summary>
 /// <param name="RootTreeItem">根节点数据</param>
 /// <param name="root">根节点XML</param>
 protected void LoadData(MyXTreeItem RootTreeItem, XmlNode root)
 {
     ///检查是否已经存在
     foreach (XmlNode node in root.SelectNodes("CodeBox"))
     {
         XmlElement  codeNode   = (XmlElement)node;
         MyXTreeItem RetreeItem = new MyXTreeItem();
         RetreeItem.IsSelected       = false;
         RetreeItem.IsExpanded       = false;
         RetreeItem.XName            = codeNode.GetAttribute("Name");
         RetreeItem.MyHitText        = codeNode.GetAttribute("HitText");
         RetreeItem.MyCodeBoxType    = CodeBox.CodeBoxTypeMapping(codeNode.GetAttribute("CodeBoxType"));
         RetreeItem.SystemCodeString = codeNode.GetAttribute("SystemCodeString");
         RetreeItem.ReturnValue      = codeNode.GetAttribute("ReturnValue");
         foreach (XmlNode xNode in codeNode.SelectNodes("XAribute"))
         {
             ///MyXTreeItem的子项
             XAributeItem xaItem = new XAributeItem();
             ///将内容提出填装
             XmlElement xaNode = (XmlElement)xNode;
             xaItem.Parameter_name   = xaNode.GetAttribute("Name");
             xaItem.MyXAttributeType = XAribute.XAttributeTypeMapping(((XmlElement)xaNode.SelectSingleNode("PointTypeitem")).InnerText);
             xaItem.MyXAttributeSpec = XAribute.XAttributeSpecMapping(((XmlElement)xaNode.SelectSingleNode("ListTypeitem")).InnerText);
             xaItem.MyXPositonStyle  = XAribute.XPositonStyleMapping(((XmlElement)xaNode.SelectSingleNode("PositionTypeitem")).InnerText);
             xaItem.MyCanLinkType    = XAribute.CanLinkTypeMapping(((XmlElement)xaNode.SelectSingleNode("LinkTypeitem")).InnerText);
             xaItem.MyHittext        = ((XmlElement)xaNode.SelectSingleNode("TipTypeitem")).InnerText;
             xaItem.MyLastExText     = ((XmlElement)xaNode.SelectSingleNode("LastExTexteitem")).InnerText;
             ///添加到子项中
             RetreeItem.MyXaributeChildren.Add(xaItem);
         }
         ///添加子节点
         RootTreeItem.ChildrenItem.Add(RetreeItem);
     }
 }
Esempio n. 3
0
    //파티 List & 오브젝트(Select View)에 요소 추가
    public void AddKnightInParty(Knight k)
    {
        if (Cnt == 4)
        {
            return;
        }
        WorldKnightSelect obj = CodeBox.AddChildInParent(selectView, knightPrefabSelect).GetComponent <WorldKnightSelect>();

        //사용하지 않는 Texture 찾아 출력
        int i;

        for (i = 0; i < 4; i++)
        {
            if (txrArr.Contains(i) == false)
            {
                break;
            }
        }

        txrArr.Add(i);
        SkinObjs[i].SetData(k);
        obj.SetData(k.num, textures[i], i);

        Cnt++;
    }
        /// <summary>
        /// 初始化基本信息
        /// </summary>
        protected override void InitBaseInfo()
        {
            base.InitBaseInfo();
            ///创建函数入口代码块
            FunctionEnterBox            = CreateXCodeBox("方法入口", CenterPoint, CodeBox.XAType.XFunctionEnter);
            FunctionEnterBox.OpenButton = 2;
            FunctionEnterBox.AddXExcXAribute();
            FunctionEnterBox.XAributeChangeMessage = () => { XAributeChangeMessage(this); };///属性消息变更通知
            ///创建函数出口代码块
            CodeBox functionExc = CreateXCodeBox("方法出口", new Point(CenterPoint.X + 250, CenterPoint.Y), CodeBox.XAType.XFunctionExc);

            functionExc.OpenButton = 1;
            functionExc.AddXEnterXAribute();
            functionExc.XAributeChangeMessage = () => { XAributeChangeMessage(this); };///属性消息变更通知
            ///保存函数出口代码块的地址
            FunctionExcBox = functionExc;

            ///添加初始连线
            XAribute   FirstXa      = FunctionEnterBox.GetRightExc()[0];
            XAribute   SecondXa     = functionExc.GetLeftEnter();
            BezierLine MyBezierLine = new BezierLine(CreateBezierID(), FirstXa.BorderColor, FirstXa.GetWorldPosition(), FirstXa.SelectPositionStyle);

            AddBezierLine(MyBezierLine);
            FirstXa.AddBezierLine(MyBezierLine);
            MyBezierLine.StartPoint.LinkAribute = FirstXa;
            SecondXa.AddBezierLine(MyBezierLine);
            MyBezierLine.EndPoint.LinkAribute = SecondXa;
            MyBezierLine.SetBezierLine(SecondXa.GetWorldPosition(), SecondXa.SelectPositionStyle);
        }
Esempio n. 5
0
        void LinkAndOptimize(CodeBox box)
        {
            box.LinkedCode = null;  // Force top-level re-link
            box.LinkCode();

            int minOpt = box.Symbol.CodeExprIndex + box.Symbol.ArraySize;

            if (box.Params.Count != 0)
            {
                minOpt = Math.Max(minOpt, box.Params[box.Params.Count - 1].CodeExprIndex
                                  + box.Params[box.Params.Count - 1].ArraySize);
            }

            if (box.Locals.Count != 0)
            {
                minOpt = Math.Max(minOpt, box.Locals[box.Locals.Count - 1].CodeExprIndex
                                  + box.Locals[box.Locals.Count - 1].ArraySize);
            }

            // Optimize, unless disabled
            if (!checkDisableOptimizer.Checked)
            {
                new Optimizer(box.LinkedCode, minOpt);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 将XML对象转换回CodeBox对象
        /// </summary>
        /// <param name="boxElement"></param>
        /// <returns></returns>
        public static void ReadCodeBoxObject(XmlNode boxnode, PicTabPage pic)
        {
            XmlElement boxElement = (XmlElement)boxnode;
            //CodeBox ReBox = new CodeBox();
            int    Id    = int.Parse(boxElement.GetAttribute("ID"));
            string Title = boxElement.GetAttribute("Title");
            string Hint  = boxElement.GetAttribute("HitText");

            CodeBox.XAType CodeboxType = CodeBox.CodeBoxTypeMapping(boxElement.GetAttribute("CodeBoxType"));
            Point          position    = new Point();

            position.X = float.Parse(boxElement.GetAttribute("PositionX"));
            position.Y = float.Parse(boxElement.GetAttribute("PositionY"));
            string SystemCodeString = boxElement.GetAttribute("SystemCodeString");
            string ReturnValueName  = boxElement.GetAttribute("ReturnValueName");
            ///加载一个CodeBox
            CodeBox ReBox = pic.LoadXCodeBox(Title, position, Id, CodeboxType);

            ReBox.SystemCodeString = SystemCodeString;
            ReBox.ReturnValueName  = ReturnValueName;
            ///循环左边属性
            XmlNode LeftXAribute = boxnode.SelectSingleNode("LeftXAribute");

            foreach (XmlNode node in LeftXAribute.SelectNodes("XAribute"))
            {
                ReadXAributeObject(node, ReBox);
            }
            ///循环右边属性
            XmlNode RightXAribute = boxnode.SelectSingleNode("RightXAribute");

            foreach (XmlNode node in RightXAribute.SelectNodes("XAribute"))
            {
                ReadXAributeObject(node, ReBox);
            }
        }
Esempio n. 7
0
        private void Button_Submit(object sender, RoutedEventArgs e)
        {
            if (!(MyProblemList.SelectedItem is Problem x))
            {
                MessageBox.Show("请选择题目", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            var type = string.Empty;

            foreach (var i in LangBox.Items)
            {
                if (i is RadioButton t)
                {
                    if (t.IsChecked ?? false)
                    {
                        type = t.Content.ToString();
                    }
                }
            }
            if (!string.IsNullOrEmpty(CodeBox.Text) && !string.IsNullOrEmpty(type))
            {
                Connection.UpdateMainPage.Invoke($"{DateTime.Now:yyyy/MM/dd HH:mm:ss} 提交代码,题目:{x.ProblemName}");
                Connection.SendData("SubmitCodeForCompetition",
                                    x.ProblemId + Connection.Divpar + _competition.CompetitionId + Connection.Divpar + type +
                                    Connection.Divpar + CodeBox.Text);
                CodeBox.Clear();
            }
            else
            {
                if (string.IsNullOrEmpty(type))
                {
                    MessageBox.Show("请选择语言", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
        }
Esempio n. 8
0
 /// <summary>
 /// 将CodeBox信息写入XML文件
 /// </summary>
 /// <param name="writer">XML对象</param>
 /// <param name="box">CodeBox对象</param>
 public static void WriteCodeBoxAribute(XmlTextWriter writer, CodeBox box)
 {
     writer.WriteStartElement("CodeBox");
     writer.WriteAttributeString("Title", box.Title);
     writer.WriteAttributeString("HitText", box.Hint);
     writer.WriteAttributeString("PositionX", box.GetPosition().X.ToString());
     writer.WriteAttributeString("PositionY", box.GetPosition().Y.ToString());
     writer.WriteAttributeString("ID", box.Id.ToString());
     writer.WriteAttributeString("CodeBoxType", box.CodeBoxType.ToString());
     writer.WriteAttributeString("SystemCodeString", box.SystemCodeString);
     writer.WriteAttributeString("ReturnValueName", box.ReturnValueName);
     ///写入左边属性
     writer.WriteStartElement("LeftXAribute");
     foreach (XAribute node in box.LeftAribute.Children)
     {
         WriteXAribute(writer, node);
     }
     ///结束写入左边边属性
     writer.WriteEndElement();
     writer.WriteStartElement("RightXAribute");
     foreach (XAribute node in box.RightAribute.Children)
     {
         WriteXAribute(writer, node);
     }
     ///结束写入右边属性
     writer.WriteEndElement();
     writer.WriteEndElement();
 }
Esempio n. 9
0
        private void UpdateCodeBox()
        {
            CodeBox.Clear();
            int index = PassesListBox.SelectedIndex;

            if (index == -1)
            {
                return;
            }
            TextSection section = (TextSection)PassesListBox.SelectedItem;
            TextSection prior   = index == 0 ? null : PassesListBox.Items[index - 1] as TextSection;

            if (prior == null || section.Text == prior.Text || RightButton.Checked)
            {
                CodeBox.Text = section.Text;
            }
            else if (LeftButton.Checked)
            {
                CodeBox.Text = (prior == null) ? "(no prior text)" : prior.Text;
            }
            else
            {
                TextSection.RunDiff(prior, section, CodeBox);
            }
            CodeBox.Modified = false;
            InvalidateApplyChanges();
        }
        public void DefaultState()
        {
            SourceCodeDisplay code = new SourceCodeDisplay();

            Assert.NotNull(code.PluginItem);
            Assert.That(code.PluginItem.Text, Is.EqualTo("Display source code context"));
            Assert.NotNull(code.OptionItems);
            Assert.That(code.OptionItems.Length, Is.EqualTo(1));
            Assert.NotNull(code.Content);
            Assert.That(code.Content, Is.TypeOf(typeof(SplitterBox)));

            SplitterBox splitter = code.Content as SplitterBox;

            Assert.That(splitter.Controls.Count, Is.EqualTo(2));

            CodeBox codeBox = splitter.Control2 as CodeBox;

            Assert.NotNull(codeBox);
            Assert.True(codeBox.ShowCurrentLine);
            Assert.That(codeBox.CurrentLineBackColor, Is.EqualTo(Color.Red));
            Assert.That(codeBox.CurrentLineForeColor, Is.EqualTo(Color.White));

            Assert.True(code.AutoSelectFirstItem);
            Assert.That(code.ListOrderPolicy, Is.EqualTo(ErrorListOrderPolicy.InitialOrder));
            Assert.That(code.SplitOrientation, Is.EqualTo(Orientation.Vertical));
            Assert.That(code.SplitterDistance, Is.EqualTo(0.5f));

            return;
        }
Esempio n. 11
0
 /// <summary>
 /// 新建项目
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void NewProject_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         NewProject nProject = new NewProject();
         ///设置项目类
         nProject.SetProjectClass(_myProject, _solution);
         nProject.ShowDialog();
         if (_myProject.RootPath != "")
         {
             ///设置项目根目录
             Solution.RootPath = _myProject.RootPath;
             ///创建主类和主函数信息
             PicTabPage mainpage = new PicTabPage((new Random()).Next(1, 2000000), this.ChileEventCallBack, "Program.cx");
             CodeBox    mainbox  = mainpage.CreateXCodeBox("Main", PicTabPage.CenterPoint, CodeBox.XAType.XMain);
             mainbox.AddAttribute(MyXAribute.XAribute.XAttributeType.XExc, MyXAribute.XAribute.XAttributeSpec.XNone,
                                  MyXAribute.XAribute.XPositonStyle.right, "出口", MyXAribute.XAribute.CanLinkType.One, "主函数出口", "");
             ///添加主信息
             _myProject.AddPicTabPage(mainpage);
             ///将代码图添加到tab页
             AddLayoutDocument(ContentPanel, mainpage);
             ///绑定各个面板数据
             BindingPanels(mainpage);
         }
         ///保存配置文件路径
         Solution.SolutionConfigPath = XCreateConfigurationInformation.SolutionConfigPath;
         ///添加到解决方案
         Solution.AddProjectClass(MyProject);
     }
     catch (Exception ex)
     {
         LoggerHelp.WriteLogger(ex.ToString());
     }
 }
Esempio n. 12
0
        /// <summary>
        /// 解析主函数
        /// </summary>
        /// <param name="box">主函数的Box</param>
        protected string AnalyticalMain(CodeBox box)
        {
            string startCode =
                "void main()" + LineBreaks
                + "{" + LineBreaks;
            string codeString = "";

            codeString += startCode;
            try
            {
                ///提取出第一个正常节点
                if (((XAribute)box.RightAribute.Children[0]).SelectType == XAribute.XAttributeType.XExc)
                {
                    CodeBox noramlBox = (CodeBox)((XAribute)box.RightAribute.Children[0]).GetOtherXAribute().ParentControl;
                    codeString += AnalyticalNormal(noramlBox);
                }
            }
            catch (Exception ex)
            {
                LoggerHelp.WriteLogger(ex.ToString());
            }
            codeString += "printf(\"\\n请按任意键退出!\");" + LineBreaks + "getch();" + LineBreaks;
            codeString += "}" + LineBreaks;
            return(codeString);
        }
Esempio n. 13
0
        /// <summary>
        /// Recompile or display hover message when necessary
        /// </summary>
        private void timer1_Tick(object sender, EventArgs e)
        {
            // Recompile 250 milliseconds after the user stops typing
            if (mLastEditorChangedTime != new DateTime() &&
                (DateTime.Now - mLastEditorChangedTime).TotalMilliseconds > 250)
            {
                try
                {
                    // Reset the lexer, re-parse, and compile
                    mLastEditorChangedTime = new DateTime();
                    Parser    parser  = new Parser(editor1.Lexer);
                    DateTime  t1      = DateTime.Now;
                    SyntaxBox program = parser.Parse();
                    DateTime  t2      = DateTime.Now;
                    CodeBox   code    = new CodeBox(null, program);
                    DateTime  t3      = DateTime.Now;
                    editor1.Invalidate();

                    // Debug times
                    TimeSpan parseTime = t2 - t1;
                    TimeSpan genTime   = t3 - t2;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, "Error compiling: " + ex.Message, App.Name);
                }
            }

            // Find out if all simulation form windows have closed
            for (int i = 0; i < mSimulationForms.Count; i++)
            {
                if (mSimulationForms[i].IsDisposed)
                {
                    mSimulationForms.RemoveAt(i);
                }
            }

            // Make the editor read-only if there is a simulation form open
            editor1.ReadOnly = mSimulationForms.Count != 0;

            // Display the hover message (after no mouse movement for 150 milliseconds)
            if (mHoverToken != null &&
                mHoverToken.Type != eTokenType.Comment &&
                mHoverToken.InfoString != "" &&
                (DateTime.Now - mLastMouseMoveTime).TotalMilliseconds > 150 &&
                !mHoverMessageForm.Visible)
            {
                // Set form size, location, and text
                mHoverMessageForm.Message.Text = mHoverToken.InfoString;
                Size s = mHoverMessageForm.Message.Size;
                mHoverMessageForm.ClientSize = new Size(s.Width + 8, s.Height + 8);
                Point p = editor1.PointToScreen(editor1.LocationToken(mHoverToken.Location));
                p.Y -= s.Height + 32;
                mHoverMessageForm.Location = p;

                // Display the form
                mHoverMessageForm.Show(this);
                this.Focus();
            }
        }
Esempio n. 14
0
    public void MakeKnightList()
    {
        selectKnighObj.SetActive(true);

        CodeBox.ClearList(selectKnightListTr);

        foreach (Knight k in unit.knights)
        {
            if (k.teaming == true)
            {
                continue;
            }
            GameObject obj = CodeBox.AddChildInParent(selectKnightListTr, knightPrefab);

            obj.GetComponent <WorldKnightPrefab>().SetData(k);
        }

        //초기화.

        selectDayList.SetData(dungeon.GetDungeonProgress(d).SearchP == 100 ? true : false);

        CodeBox.ClearList(selectView);
        txrArr.Clear();
        Cnt = 0;
    }
Esempio n. 15
0
 //WorkListController - Click(7) 에서 호출. 귀환 후
 public void UpdateDungeonInWorld()
 {
     foreach (Transform tr in dungeonPos)
     {
         CodeBox.ClearList(tr);
     }
     CreateDungeonInWorld();
 }
Esempio n. 16
0
 private void SaveExecuted(object sender, ExecutedRoutedEventArgs e)
 {
     if (this.DataContext == null)
     {
         return;
     }
     CodeBox.GetBindingExpression(TextBox.TextProperty).UpdateSource();
     ((ProjectViewModel)this.DataContext).Save.Execute(e.Parameter);
 }
Esempio n. 17
0
    private void LoadNodeArray <T>(ref T[] array, XmlNode node, string name)
    {
        int[] split = CodeBox.StringSplit(node.SelectSingleNode(name).InnerText);
        array = new T[split.Length];

        for (int index = 0; index < array.Length; index++)
        {
            array[index] = (T)Convert.ChangeType(split[index], typeof(T));
        }
    }
Esempio n. 18
0
        /// <summary>
        /// 从文件中加载一个代码块
        /// </summary>
        /// <param name="name"></param>
        /// <param name="position"></param>
        /// <param name="id"></param>
        /// <param name="CodeboxType"></param>
        /// <returns></returns>
        public CodeBox LoadXCodeBox(string name, Point position, int id, CodeBox.XAType CodeboxType = CodeBox.XAType.XFunction)
        {
            CodeBox box = new CodeBox(id, this, name, ChileEventCallBack, CodeboxType);

            box.SetPosition(position);
            //xa.AddAttribute(XRadioButton.XAttributeType.XEnter, XRadioButton.XPositonStyle.Left);
            ListCodeBoxChild.Add(id, box);
            this.Children.Add(box);
            return(box);
        }
Esempio n. 19
0
    public void CreateDungeonInWorld()
    {
        dungeon = DungeonData.Instance;
        for (int i = 0; i < 8; i++)
        {
            GameObject obj = CodeBox.AddChildInParent(dungeonPos[i], dungeon.dungeonObjArray[dungeon.dungeon_Progress[i].d.num]);
            obj.GetComponentInChildren <WorldDungeonPrefab>().SetData(dungeon.dungeon_Progress[i], i);
        }

        DungeonUpdate();
    }
Esempio n. 20
0
        /// <summary>
        /// 创建一个代码块
        /// </summary>
        /// <param name="name"></param>
        /// <param name="id"></param>
        public CodeBox CreateXCodeBox(string name, Point position, CodeBox.XAType CodeboxType = CodeBox.XAType.XFunction)
        {
            int     id = CreadCodeBoxID();
            CodeBox xa = new CodeBox(id, this, name, ChileEventCallBack, CodeboxType);

            xa.SetPosition(position);
            //xa.AddAttribute(XRadioButton.XAttributeType.XEnter, XRadioButton.XPositonStyle.Left);
            ListCodeBoxChild.Add(id, xa);
            this.Children.Add(xa);
            return(xa);
        }
Esempio n. 21
0
 //==========================================================================
 //Update text
 //==========================================================================
 public void UpdateCode(List <string> text)
 {
     for (int i = 0; i < text.Count(); i++)
     {
         CodeBox.AppendText(text[i]);
         if (i + 1 < text.Count())
         {
             CodeBox.AppendText(Environment.NewLine);
         }
     }
 }
Esempio n. 22
0
        private void listBoxes_SelectedIndexChanged(object sender, EventArgs e)
        {
            CodeBox box = CurrentBox;

            if (box == null)
            {
                groupCompile.Enabled = false;
                return;
            }
            groupCompile.Enabled = !box.Error;
        }
Esempio n. 23
0
    private void MonsterSetting()
    {
        Debug.Log(" MonsterSetting() 실행");

        //2-0 초기화
        phaseInMonsterCnt = 0;
        while (thing.Count > knightCount)
        {
            thing.RemoveAt(knightCount);
            thingTarget.RemoveAt(knightCount);
        }

        //2-1 표시될 몬스터를 showMonster에서 호출함
        for (int i = 0; i < 4; i++)
        {
            //2-1-E 더 이상 호출한 몬스터가 없음.
            if (monsterList.Count == 0)
            {
                //표시될 몬스터가 있으면, 로드 종료
                //               없으면, [승리] 상태가됨.
                if (mps[0].s.alive == AliveType.생존)
                {
                    for (; i < 4; i++)
                    {
                        msv[i].gameObject.SetActive(false);//스테이트,COL임
                    }
                    break;
                }
                State = BattleState.승리;
                return;
            }

            monsterObj = MonsterData.Instance.monsterPrefabs[monsterList[0].num];

            mps[i] = CodeBox.AddChildInParent(monsterPos[i], monsterObj).GetComponentInChildren <BattleMonsterPrefab>();
            //2-1-1 show와 thing 에 추가
            mps[i].SetData(monsterList[0], i, msv[i]);
            thing.Add(mps[i].s);
            thingTarget.Add(4 + i);
            phaseInMonsterCnt++;
            //2-1-1-2 스테이트 상태COL 활성화
            msv[i].gameObject.SetActive(true);
            msv[i].SetData(mps[i]);
            //2-1-2 호출된 몬스터는 리스트에서 삭제
            monsterList.Remove(monsterList[0]);
        }
        msv[4].gameObject.SetActive(false);//※이거 보스...


        //2-2 몬스터 세팅 완료했으니 전투 순서를 정해줌. (3-1 이동)
        Turn = 0;
        SettingTurn();
    }
Esempio n. 24
0
 private void New()
 {
     if (!AskForSave())
     {
         return;
     }
     path = null;
     CodeBox.Clear();
     // 清空撤销栈
     CodeBox.IsUndoEnabled = false;
     CodeBox.IsUndoEnabled = true;
 }
Esempio n. 25
0
    //KightList생성
    public void MakeKinghtList(Transform list)
    {
        CodeBox.ClearList(list);

        int index = 0;

        foreach (Knight k in unit.knights)
        {
            GameObject obj = CodeBox.AddChildInParent(list, knightPrefab);
            obj.GetComponent <KnightPrefab>().SetData(k);
        }
    }
Esempio n. 26
0
 public MainWindow()
 {
     InitializeComponent();
     // 更新状态栏
     CodeBox.SelectionChanged += (s, e) =>
     {
         int lineIndex = CodeBox.GetLineIndexFromCharacterIndex(CodeBox.CaretIndex);
         LineIndexSBI.Content       = lineIndex + 1;
         ColIndexSBI.Content        = CodeBox.CaretIndex - CodeBox.GetCharacterIndexFromLineIndex(lineIndex) + 1;
         SelectionLengthSBI.Content = CodeBox.SelectionLength;
     };
     CodeBox.DecorationScheme = CodeBoxControl.Decorations.DecorationSchemes.Java;
 }
Esempio n. 27
0
        private async void Request(object sender, RoutedEventArgs e)
        {
            ErrorText.Visibility = Visibility.Collapsed;
            ForgotPasswordViewModel vm = new ForgotPasswordViewModel()
            {
                Email = EmailBox.Text
            };

            ValidationContext       validationContext = new ValidationContext(vm);
            List <ValidationResult> validationResults = new List <ValidationResult>();
            bool isValid = Validator.TryValidateObject(vm, validationContext, validationResults, true);

            if (isValid)
            {
                JObject result = await App.dataService.ForgotPassword(vm);

                if (result["success"].ToString() == "True")
                {
                    // Really, I tried to do it with x:Bind but the ui wouldn't update
                    EmailBox.IsReadOnly = true;
                    CodeBox.Visibility  = Visibility.Visible;
                    CodeBox.Focus(FocusState.Programmatic);
                    Border1.Visibility            = Visibility.Visible;
                    Message.Visibility            = Visibility.Visible;
                    PasswordBox.Visibility        = Visibility.Visible;
                    ConfirmPasswordBox.Visibility = Visibility.Visible;
                    ResetButton.Visibility        = Visibility.Visible;
                    RequestButton.Visibility      = Visibility.Collapsed;
                    ErrorText.Visibility          = Visibility.Collapsed;
                }
                else
                {
                    var test = result["errors"];
                    if (result["errors"] == null)
                    {
                        ErrorText.Text = "Error";
                    }
                    else
                    {
                        ErrorText.Text = result["errors"][0]["message"].ToString();
                    }
                    ErrorText.Visibility = Visibility.Visible;
                }
            }
            else
            {
                ErrorText.Text       = validationResults[0].ErrorMessage;
                ErrorText.Visibility = Visibility.Visible;
            }
        }
Esempio n. 28
0
 /// <summary>
 /// 移动所有被选择的控件
 /// </summary>
 /// <param name="toMovePoint">移动的向量</param>
 protected void MoveSelectControl(Point toMovePoint, CodeBox cd)
 {
     foreach (int key in ListCodeBoxChild.Keys)
     {
         if (ListCodeBoxChild[key].SelectState)
         {
             Type sendtype = ListCodeBoxChild[key].GetType();
             if (sendtype.Name == "CodeBox" && ((CodeBox)ListCodeBoxChild[key]) != cd)
             {
                 ((CodeBox)ListCodeBoxChild[key]).SetVectorMove(toMovePoint);
             }
         }
     }
 }
Esempio n. 29
0
        public void Can_Set_Back_And_Fore_Colors()
        {
            CodeBox box;

            box      = new CodeBox();
            box.Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.";

            box.CurrentLineBackColor = Color.Black;
            Assert.That(box.CurrentLineBackColor, Is.EqualTo(Color.Black));

            box.CurrentLineForeColor = Color.Blue;
            Assert.That(box.CurrentLineForeColor, Is.EqualTo(Color.Blue));

            return;
        }
Esempio n. 30
0
    public void SetForm()
    {
        DungeonProgress dp = EventData.Instance.battle_dp;

        formObj = new GameObject[dp.p.k.Length];

        int index = 0;

        foreach (int kNum in dp.p.k)
        {
            formObj[index] = CodeBox.AddChildInParent(BattleUI.transform, basicForm);

            formObj[index].GetComponent <Form>().SetData(battle.kps[index]);
            formObj[index++].SetActive(false);
        }
    }