示例#1
0
        public void OnSaveRound()
        {
            if (m_ListStiches.Count > 0)
            {
                m_CurrentRound.Repeats = m_Round.RoundRepeat;

                m_CurrentRound.StichCount = 0;

                m_CurrentRound.Stiches = new List <Stich>();

                for (int i = 0; i < m_ListStiches.Count; i++)
                {
                    Stich stich = m_ListStiches[i];
                    m_CurrentRound.Stiches.Add(stich);
                }

                for (int iRepeat = 0; iRepeat < m_CurrentRound.Repeats; iRepeat++)
                {
                    for (int iStich = 0; iStich < m_ListStiches.Count; iStich++)
                    {
                        Stich stich = m_ListStiches[iStich];
                        m_CurrentRound.StichCount += stich.NumberRepeats;

                        // Find incremental
                        string auxS = stich.Name.TrimStart().TrimEnd().ToLower();
                        if (auxS.Contains("inc") || auxS.Contains("incremental"))
                        {
                            Debug.Log("Number Stiches x2");
                            m_CurrentRound.StichCount += (stich.NumberRepeats * 2);
                        }
                    }
                }

                // Save current round in JSON and create new round
                //int numberRounds = AppController.Instance.SaveRound(m_CurrentRound);

                string message = "Round " + m_RoundNumber + " - " + m_CurrentRound.StichCount + " stich(es)";
                AppController.Instance.MessagePopup.ShowPopup("New round added", message,
                                                              "Ok", OnOkPopupBtnPress, string.Empty, null, string.Empty, null);


                // Reset all
                m_RoundNumber             += 1;
                m_CurrentRound             = new Round();
                m_CurrentRound.PartName    = m_PartName;
                m_CurrentRound.RoundNumber = m_RoundNumber;

                m_ListStiches = new List <Stich>();
                m_Round.Reset();

                AppController.Instance.TopBar.Title = m_PartName + "  - Round: " + m_CurrentRound.RoundNumber;
            }
            else
            {
                AppController.Instance.MessagePopup.ShowPopup("No stiches",
                                                              "Include some stiches for the round",
                                                              "Ok", OnOkPopupBtnPress,
                                                              string.Empty, null, string.Empty, null);
            }
        }
示例#2
0
        public void AddStich()
        {
            if (!string.IsNullOrEmpty(m_Round.Stich))
            {
                Stich stich = new Stich();

                stich.Name = m_Round.Stich;

                stich.NumberRepeats = m_Round.StichRepeats;

                m_ListStiches.Add(stich);

                m_Round.CurrentRound = PrintStiches();
            }
        }
示例#3
0
        public void OnSaveRound()
        {
            if (m_ListStiches.Count > 0)
            {
                m_CurrentRound.Repeats    = m_Round.RoundRepeat;
                m_CurrentRound.StichCount = 0;
                m_CurrentRound.Stiches    = new List <Stich>();

                for (int i = 0; i < m_ListStiches.Count; i++)
                {
                    Stich stich = m_ListStiches[i];
                    m_CurrentRound.Stiches.Add(stich);
                }

                for (int iRepeat = 0; iRepeat < m_CurrentRound.Repeats; iRepeat++)
                {
                    for (int iStich = 0; iStich < m_ListStiches.Count; iStich++)
                    {
                        Stich stich = m_ListStiches[iStich];
                        //m_CurrentRound.StichCount += stich.NumberRepeats;

                        // Find incremental
                        string auxS = stich.Name.TrimStart().TrimEnd().ToLower();

                        /*if (auxS.Contains("inc") || auxS.Contains("incremental"))
                         * {
                         *  Debug.Log("Number Stiches x2");
                         *  m_CurrentRound.StichCount += (stich.NumberRepeats * 2);
                         * }*/
                    }
                }

                // Save
                Save();
            }
            else
            {
                ToolController.Instance.MessagePopup.ShowPopup("No stiches",
                                                               "Include some stiches for the round",
                                                               "Ok", OnOkPopupBtnPress,
                                                               string.Empty, null, string.Empty, null);
            }
        }
示例#4
0
        public void AddStich()
        {
            if (!string.IsNullOrEmpty(m_Round.Stich))
            {
                Stich stich = new Stich();
                stich.Name = m_Round.Stich;

                stich.NumberRepeats = m_Round.StichRepeats;

                m_ListStiches.Add(stich);

                m_Round.CurrentRound = PrintStiches();
            }
            else
            {
                /*m_MessagePopup.ShowPopup(
                 * "Warning",
                 * "Add at least 1 stich",
                 * "Ok", OnOkBtn,
                 * string.Empty, null, string.Empty, null);*/
            }
        }