Beispiel #1
0
        public async Task UpdateLink(LinkMod link, DocumentMod document, StyleMod style, string value)
        {
            var generatedValue = "";

            if (string.IsNullOrEmpty(value))
            {
                generatedValue = GenerateLinkValue(document, style, value);
            }
            else
            {
                generatedValue = value;
            }

            var styles = await _database.Styles.GetAll();

            var changedStyle = styles.Where(s => s.Id == style.Id).Select(s => s).SingleOrDefault();

            var linkDB = new DataAccessLevel.Entities.Reference()
            {
                Id         = link.Id,
                Value      = generatedValue,
                DocumentId = link.DocumentId,
                Document   = link.Document,
                StyleId    = changedStyle.Id,
                Style      = changedStyle
            };
            await _database.References.Update(linkDB, link.DocumentId, link.StyleId);
        }
Beispiel #2
0
        public void popStyleVar(int count)
        {
            for (int i = 0; i < count; i++)
            {
                StyleMod mod = styleStack.Pop();
                switch (mod.style)
                {
                case StyleVar.Alpha: alpha = mod.prevousValue.X; break;

                case StyleVar.WindowFillAlpha: windowFillAlphaDefault = mod.prevousValue.X; break;

                case StyleVar.WindowRounding: windowRounding = mod.prevousValue.X; break;

                case StyleVar.ChildWindowRounding: childWindowRounding = mod.prevousValue.X; break;

                case StyleVar.FrameRounding: frameRounding = mod.prevousValue.X; break;

                case StyleVar.IndentSpacing: indentSpacing = mod.prevousValue.X; break;

                case StyleVar.GrabMinSize: grabMinSize = mod.prevousValue.X; break;

                case StyleVar.WindowPadding: windowPadding = mod.prevousValue; break;

                case StyleVar.WindowMinSize: windowMinSize = mod.prevousValue; break;

                case StyleVar.FramePadding: framePadding = mod.prevousValue; break;

                case StyleVar.ItemSpacing: itemSpacing = mod.prevousValue; break;

                case StyleVar.ItemInnerSpacing: itemInnerSpacing = mod.prevousValue; break;
                }
            }
        }
Beispiel #3
0
        public void pushStyleVar(StyleVar var, float value)
        {
            StyleMod mod = new StyleMod();

            mod.style = var;
            switch (var)
            {
            case StyleVar.Alpha: mod.prevousValue.X = alpha; alpha = value; break;

            case StyleVar.WindowFillAlpha: mod.prevousValue.X = windowFillAlphaDefault; windowFillAlphaDefault = value; break;

            case StyleVar.WindowRounding: mod.prevousValue.X = windowRounding; windowRounding = value; break;

            case StyleVar.ChildWindowRounding: mod.prevousValue.X = childWindowRounding; childWindowRounding = value; break;

            case StyleVar.FrameRounding: mod.prevousValue.X = frameRounding; frameRounding = value; break;

            case StyleVar.IndentSpacing: mod.prevousValue.X = indentSpacing; indentSpacing = value; break;

            case StyleVar.GrabMinSize: mod.prevousValue.X = grabMinSize; grabMinSize = value; break;

            default: throw new Exception(String.Format("Can't find float var {0}", var));
            }

            styleStack.Push(mod);
        }
Beispiel #4
0
 public async Task DeleteStyle(StyleMod style)
 {
     await _database.Styles.Delete(new DataAccessLevel.Entities.Style.Style()
     {
         Id = style.Id
     });
 }
Beispiel #5
0
    //Casts spell from NPC (enemy or ally)
    public List <CastData> cast(SpellData spell, ICaster[] targets, int selected, ICaster[] allies, int position, out List <Transform> noTargetPositions)
    {
        noTargetPositions = new List <Transform>();
        ICaster caster = allies[position];
        Spell   s      = spells[spell.root];
        Spell   c      = createSpellFromType(s.type);

        s.copyInto(c);
        int wordCount = 1;

        string[]   animData = { null, s.animationID, null };
        string[]   sfxData  = { null, s.sfxID, null };
        ElementMod e        = null;
        StyleMod   st       = null;

        if (spell.element != null)
        {
            e           = elements[spell.element];
            sfxData[2]  = e.sfxID;
            animData[2] = e.animationID;
            ++wordCount;
        }
        if (spell.style != null)
        {
            st          = styles[spell.style];
            sfxData[0]  = st.sfxID;
            animData[0] = st.animationID;
            ++wordCount;
        }
        c.Modify(e, st);
        List <ICaster>  toCastAt = c.target(targets, selected, allies, position);
        List <CastData> data     = new List <CastData>();

        foreach (ICaster target in toCastAt)
        {
            if (target == null)
            {
                continue;
            }
            if (target.Is_dead)
            {
                noTargetPositions.Add(target.Transform);
                continue;
            }
            CastData castData = c.cast(target, caster);
            animData.CopyTo(castData.animData, 0);
            sfxData.CopyTo(castData.sfxData, 0);
            castData.wordCount = wordCount;
            if (castData.repel == true)
            {
                castData.setLocationData(caster, target);
            }
            else
            {
                castData.setLocationData(target, caster);
            }
            data.Add(castData);
        }
        return(data);
    }
Beispiel #6
0
        public async Task CreateLink(DocumentMod document, StyleMod style, string value)
        {
            var generatedValue = "";

            if (string.IsNullOrEmpty(value))
            {
                generatedValue = GenerateLinkValue(document, style, value);
            }
            else
            {
                generatedValue = value;
            }

            var linkDB = new DataAccessLevel.Entities.Reference()
            {
                Value = generatedValue
            };
            await _database.References.Create(linkDB, document.Id, style.Id);
        }
Beispiel #7
0
        public void pushStyleVar(StyleVar var, Vector2 value)
        {
            StyleMod mod = new StyleMod();

            mod.style = var;
            switch (var)
            {
            case StyleVar.WindowPadding: mod.prevousValue = windowPadding; windowPadding = value; break;

            case StyleVar.WindowMinSize: mod.prevousValue = windowMinSize; windowMinSize = value; break;

            case StyleVar.FramePadding: mod.prevousValue = framePadding; framePadding = value; break;

            case StyleVar.ItemSpacing: mod.prevousValue = itemSpacing; itemSpacing = value; break;

            case StyleVar.ItemInnerSpacing: mod.prevousValue = itemInnerSpacing; itemInnerSpacing = value; break;

            default: throw new Exception(String.Format("Can't find Vector2 var {0}", var));
            }

            styleStack.Push(mod);
        }
Beispiel #8
0
 //Apllies prefix and suffix to spell. both arguments can be null (if no prefix or suffix)
 public void Modify(ElementMod e, StyleMod s)
 {
     //Dont modify if unmodifyable
     if (modFlag == ModFlags.NO_MODIFICATION)
     {
         return;
     }
     //Add rest of stuff
     if (e != null && modFlag != ModFlags.NO_ELEMENT)//Add element modifier
     {
         element = e.element;
         name    = e.name + "-" + name;
     }
     if (s != null && modFlag != ModFlags.NO_STYLE)//Add style modifier
     {
         //Modify targeting data if allowed and necessary
         if (s.isTarget == true)
         {
             if (modFlag == ModFlags.NO_TARGETING)
             {
                 return;
             }
             s.targets.modify(targetData);
         }
         //Apply power mod
         power  = Mathf.CeilToInt(power * s.powerModM);
         power += s.powerMod;
         //Apply acc mod
         hitPercentage  = Mathf.CeilToInt(hitPercentage * s.accModM);
         hitPercentage += s.accMod;
         //Appl crit mod
         critPercentage  = Mathf.CeilToInt(critPercentage * s.critModM);
         critPercentage += s.critMod;
         //Apply status % mod
         elementEffectMod  = Mathf.CeilToInt(elementEffectMod * s.statusEffectChanceModM);
         elementEffectMod += s.statusEffectChanceMod;
         name             += ("-" + s.name);
     }
 }
Beispiel #9
0
        public string GenerateLinkValue(DocumentMod document, StyleMod style, string value)
        {
            var valueResult = "";
            var strBuilder  = new StringBuilder();

            switch (document.Type)
            {
            case DataAccessLevel.Enums.DocumentType.Article:
                if (style.AuthorFirst.Label.Form == "short")
                {
                    var nameInitial       = $"{document.Author.Name.Substring(0, 1)}{style.AuthorFirst.Name.InitializeWith}";
                    var patronymicInitial = "";
                    if (!string.IsNullOrEmpty(document.Author.Patronymic))
                    {
                        patronymicInitial = $"{document.Author.Patronymic.Substring(0, 1)}{style.AuthorFirst.Name.InitializeWith}";
                    }
                    var initials = $"{nameInitial}{patronymicInitial}";
                    strBuilder.Append($"{style.AuthorFirst.Label.Prefix}{document.Author.Surname}{style.AuthorFirst.Name.Delimiter}{initials}{style.AuthorFirst.Label.Suffix}");
                }
                else
                {
                    strBuilder.Append($"{style.AuthorFirst.Label.Prefix}{document.Author.Surname}{style.AuthorFirst.Name.Delimiter}{document.Author.Name}{style.AuthorFirst.Name.Delimiter}{document.Author.Patronymic}{style.AuthorFirst.Name.Delimiter}{style.AuthorFirst.Label.Suffix}");
                }

                strBuilder.Append($"{style.AuthorSecond.Label.Prefix}{document.Co_Author.Name}{style.AuthorSecond.Label.Suffix}{style.AuthorSecond.Name.Delimiter}");
                strBuilder.Append($"{style.Title.Text.Prefix}{document.Title}{style.Title.Text.Suffix}");
                strBuilder.Append($"{style.Publisher.GroupPublisher.TextPublishers.FirstOrDefault().Prefix}{document.Publisher.Name}{style.Publisher.GroupPublisher.TextPublishers.FirstOrDefault().Suffix}");

                if (style.Publisher.YearDatePublisher.DatePublisher.DatePartPublishers.FirstOrDefault().NamePublisher == "year")
                {
                    strBuilder.Append($"{document.Date.ToString("yyyy")} ");
                }
                else
                {
                    strBuilder.Append($"{document.Date.ToString("dd-MM-yyyy")} ");
                }

                strBuilder.Append($"{style.PublishVolume.Text.Prefix}{document.Volume}{style.PublishVolume.Text.Suffix}");
                strBuilder.Append($"{document.Edition} ");
                strBuilder.Append($"{style.PagesRange.Text.Prefix}{document.Pages.PageFirst}{style.PageRangeDelimiter}{document.Pages.PageLast}{style.PagesRange.Text.Suffix}");

                valueResult = strBuilder.ToString();
                strBuilder.Clear();
                break;

            case DataAccessLevel.Enums.DocumentType.Conference:
                if (style.AuthorFirst.Label.Form == "short")
                {
                    var nameInitial       = $"{document.Author.Name.Substring(0, 1)}{style.AuthorFirst.Name.InitializeWith}";
                    var patronymicInitial = "";
                    if (!string.IsNullOrEmpty(document.Author.Patronymic))
                    {
                        patronymicInitial = $"{document.Author.Patronymic.Substring(0, 1)}{style.AuthorFirst.Name.InitializeWith}";
                    }
                    var initials = $"{nameInitial}{patronymicInitial}";
                    strBuilder.Append($"{style.AuthorFirst.Label.Prefix}{document.Author.Surname}{style.AuthorFirst.Name.Delimiter}{initials}{style.AuthorFirst.Label.Suffix}");
                }
                else
                {
                    strBuilder.Append($"{style.AuthorFirst.Label.Prefix}{document.Author.Surname}{style.AuthorFirst.Name.Delimiter}{document.Author.Name}{style.AuthorFirst.Name.Delimiter}{document.Author.Patronymic}{style.AuthorFirst.Name.Delimiter}{style.AuthorFirst.Label.Suffix}");
                }

                strBuilder.Append($"{style.AuthorSecond.Label.Prefix}{document.Co_Author.Name}{style.AuthorSecond.Label.Suffix}{style.AuthorSecond.Name.Delimiter}");
                strBuilder.Append($"{style.Title.Text.Prefix}{document.Title}{style.Title.Text.Suffix}");
                strBuilder.Append($"{style.TitleOfConference.Text.Prefix}{document.TitleOfConference}{style.TitleOfConference.Text.Suffix}");
                strBuilder.Append($"{style.Publisher.GroupPublisher.TextPublishers.FirstOrDefault().Prefix}{document.Publisher.Name}{style.Publisher.GroupPublisher.TextPublishers.FirstOrDefault().Suffix}");
                strBuilder.Append($"{style.Publisher.GroupPublisher.TextPublishers.FirstOrDefault().Prefix}{document.Publisher.Address}{style.Publisher.GroupPublisher.TextPublishers.FirstOrDefault().Suffix}");

                if (style.Publisher.YearDatePublisher.DatePublisher.DatePartPublishers.FirstOrDefault().NamePublisher == "year")
                {
                    strBuilder.Append($"{document.Date.ToString("yyyy")} ");
                }
                else
                {
                    strBuilder.Append($"{document.Date.ToString("dd-MM-yyyy")} ");
                }

                strBuilder.Append($"{style.PublishVolume.Text.Prefix}{document.Volume}{style.PublishVolume.Text.Suffix}");
                strBuilder.Append($"{style.PagesRange.Text.Prefix}{document.Pages.PageFirst}{style.PageRangeDelimiter}{document.Pages.PageLast}{style.PagesRange.Text.Suffix}");

                valueResult = strBuilder.ToString();
                strBuilder.Clear();
                break;

            case DataAccessLevel.Enums.DocumentType.Book:
                if (style.AuthorFirst.Label.Form == "short")
                {
                    var nameInitial       = $"{document.Author.Name.Substring(0, 1)}{style.AuthorFirst.Name.InitializeWith}";
                    var patronymicInitial = "";
                    if (!string.IsNullOrEmpty(document.Author.Patronymic))
                    {
                        patronymicInitial = $"{document.Author.Patronymic.Substring(0, 1)}{style.AuthorFirst.Name.InitializeWith}";
                    }
                    var initials = $"{nameInitial}{patronymicInitial}";
                    strBuilder.Append($"{style.AuthorFirst.Label.Prefix}{document.Author.Surname}{style.AuthorFirst.Name.Delimiter}{initials}{style.AuthorFirst.Label.Suffix}");
                }
                else
                {
                    strBuilder.Append($"{style.AuthorFirst.Label.Prefix}{document.Author.Surname}{style.AuthorFirst.Name.Delimiter}{document.Author.Name}{style.AuthorFirst.Name.Delimiter}{document.Author.Patronymic}{style.AuthorFirst.Name.Delimiter}{style.AuthorFirst.Label.Suffix}");
                }

                strBuilder.Append($"{style.AuthorSecond.Label.Prefix}{document.Co_Author.Name}{style.AuthorSecond.Label.Suffix}{style.AuthorSecond.Name.Delimiter}");
                strBuilder.Append($"{style.Title.Text.Prefix}{document.Title}{style.Title.Text.Suffix}");
                strBuilder.Append($"{style.Publisher.GroupPublisher.TextPublishers.FirstOrDefault().Prefix}{document.Publisher.Name}{style.Publisher.GroupPublisher.TextPublishers.FirstOrDefault().Suffix}");

                if (style.Publisher.YearDatePublisher.DatePublisher.DatePartPublishers.FirstOrDefault().NamePublisher == "year")
                {
                    strBuilder.Append($"{document.Date.ToString("yyyy")} ");
                }
                else
                {
                    strBuilder.Append($"{document.Date.ToString("dd-MM-yyyy")} ");
                }

                strBuilder.Append($"{style.PublishVolume.Text.Prefix}{document.Volume}{style.PublishVolume.Text.Suffix}");

                strBuilder.Append($"{style.PagesNumber.Text.Prefix}{document.Pages.CountOfPages}{style.PagesNumber.Text.Suffix}");

                valueResult = strBuilder.ToString();
                strBuilder.Clear();
                break;

            case DataAccessLevel.Enums.DocumentType.Thesis:
                if (style.AuthorFirst.Label.Form == "short")
                {
                    var nameInitial       = $"{document.Author.Name.Substring(0, 1)}{style.AuthorFirst.Name.InitializeWith}";
                    var patronymicInitial = "";
                    if (!string.IsNullOrEmpty(document.Author.Patronymic))
                    {
                        patronymicInitial = $"{document.Author.Patronymic.Substring(0, 1)}{style.AuthorFirst.Name.InitializeWith}";
                    }
                    var initials = $"{nameInitial}{patronymicInitial}";
                    strBuilder.Append($"{style.AuthorFirst.Label.Prefix}{document.Author.Surname}{style.AuthorFirst.Name.Delimiter}{initials}{style.AuthorFirst.Label.Suffix}");
                }
                else
                {
                    strBuilder.Append($"{style.AuthorFirst.Label.Prefix}{document.Author.Surname}{style.AuthorFirst.Name.Delimiter}{document.Author.Name}{style.AuthorFirst.Name.Delimiter}{document.Author.Patronymic}{style.AuthorFirst.Name.Delimiter}{style.AuthorFirst.Label.Suffix}");
                }

                strBuilder.Append($"{style.AuthorSecond.Label.Prefix}{document.Co_Author.Name}{style.AuthorSecond.Label.Suffix}{style.AuthorSecond.Name.Delimiter}");
                strBuilder.Append($"{style.Title.Text.Prefix}{document.Title}{style.Title.Text.Suffix}");
                strBuilder.Append(": Thesis (Doctorate) / ");
                strBuilder.Append($"{style.Publishuniver.GroupUniver.TextUnivers.FirstOrDefault().Prefix}{document.Publisher.Name}{style.Publishuniver.GroupUniver.TextUnivers.FirstOrDefault().Suffix}");

                if (style.Publishuniver.YearDateUniver.DateUniver.DatePartUnivers.FirstOrDefault().NameUniver == "year")
                {
                    strBuilder.Append($"{document.Date.ToString("yyyy")} ");
                }
                else
                {
                    strBuilder.Append($"{document.Date.ToString("dd-MM-yyyy")} ");
                }

                strBuilder.Append($"{style.PublishVolume.Text.Prefix}{document.Volume}{style.PublishVolume.Text.Suffix}");

                strBuilder.Append($"{style.PagesNumber.Text.Prefix}{document.Pages.CountOfPages}{style.PagesNumber.Text.Suffix}");

                valueResult = strBuilder.ToString();
                strBuilder.Clear();
                break;

            case DataAccessLevel.Enums.DocumentType.Webpage:
                valueResult = $"{style.Title.Text.Prefix}{document.Title}{style.Title.Text.Suffix}" +
                              $"{style.Webdoc.Group.Texts.FirstOrDefault().Value} {style.Webdoc.Group.Texts.FirstOrDefault().Prefix}{style.Webdoc.Group.Texts.FirstOrDefault().Suffix}";
                break;

            default:
                if (style.AuthorFirst.Label.Form == "short")
                {
                    var nameInitial       = $"{document.Author.Name.Substring(0, 1)}{style.AuthorFirst.Name.InitializeWith}";
                    var patronymicInitial = "";
                    if (!string.IsNullOrEmpty(document.Author.Patronymic))
                    {
                        patronymicInitial = $"{document.Author.Patronymic.Substring(0, 1)}{style.AuthorFirst.Name.InitializeWith}";
                    }
                    var initials = $"{nameInitial}{patronymicInitial}";
                    strBuilder.Append($"{style.AuthorFirst.Label.Prefix}{document.Author.Surname}{style.AuthorFirst.Name.Delimiter}{initials}{style.AuthorFirst.Label.Suffix}");
                }
                else
                {
                    strBuilder.Append($"{style.AuthorFirst.Label.Prefix}{document.Author.Surname}{style.AuthorFirst.Name.Delimiter}{document.Author.Name}{style.AuthorFirst.Name.Delimiter}{document.Author.Patronymic}{style.AuthorFirst.Name.Delimiter}{style.AuthorFirst.Label.Suffix}");
                }

                strBuilder.Append($"{style.AuthorSecond.Label.Prefix}{document.Co_Author.Name}{style.AuthorSecond.Label.Suffix}{style.AuthorSecond.Name.Delimiter}");
                strBuilder.Append($"{style.Title.Text.Prefix}{document.Title}{style.Title.Text.Suffix}");
                strBuilder.Append($"{style.Publisher.GroupPublisher.TextPublishers.FirstOrDefault().Prefix}{document.Publisher.Name}{style.Publisher.GroupPublisher.TextPublishers.FirstOrDefault().Suffix}");

                if (style.Publisher.YearDatePublisher.DatePublisher.DatePartPublishers.FirstOrDefault().NamePublisher == "year")
                {
                    strBuilder.Append($"{document.Date.ToString("yyyy")} ");
                }
                else
                {
                    strBuilder.Append($"{document.Date.ToString("dd-MM-yyyy")} ");
                }

                strBuilder.Append($"{style.PublishVolume.Text.Prefix}{document.Volume}{style.PublishVolume.Text.Suffix}");

                strBuilder.Append($"{style.PagesNumber.Text.Prefix}{document.Pages.CountOfPages}{style.PagesNumber.Text.Suffix}");

                valueResult = strBuilder.ToString();
                strBuilder.Clear();
                break;
            }

            return(valueResult);
        }
Beispiel #10
0
 public async Task UpdateStyle(StyleMod style)
 {
     var styleDB = new DataAccessLevel.Entities.Style.Style()
     {
         AuthorFirst = new DataAccessLevel.Entities.Style.AuthorFirst()
         {
             Label = new DataAccessLevel.Entities.Style.Label()
             {
                 Form   = style.AuthorFirst.Label.Form,
                 Prefix = style.AuthorFirst.Label.Prefix,
                 Suffix = style.AuthorFirst.Label.Suffix
             },
             Name = new DataAccessLevel.Entities.Style.Name()
             {
                 Delimiter      = style.AuthorFirst.Name.Delimiter,
                 InitializeWith = style.AuthorFirst.Name.InitializeWith
             }
         },
         AuthorSecond = new DataAccessLevel.Entities.Style.AuthorSecond()
         {
             Label = new DataAccessLevel.Entities.Style.Label()
             {
                 Form   = style.AuthorSecond.Label.Form,
                 Prefix = style.AuthorSecond.Label.Prefix,
                 Suffix = style.AuthorSecond.Label.Suffix
             },
             Name = new DataAccessLevel.Entities.Style.Name()
             {
                 Delimiter      = style.AuthorSecond.Name.Delimiter,
                 InitializeWith = style.AuthorSecond.Name.InitializeWith
             }
         },
         EtAl               = style.EtAl,
         EtAlMax            = style.EtAlMax,
         PageRangeDelimiter = style.PageRangeDelimiter,
         PagesNumber        = new DataAccessLevel.Entities.Style.PagesNumber()
         {
             Text = new DataAccessLevel.Entities.Style.Text()
             {
                 Prefix = style.PagesNumber.Text.Prefix,
                 Suffix = style.PagesNumber.Text.Suffix,
                 Value  = style.PagesNumber.Text.Value
             }
         },
         PagesRange = new DataAccessLevel.Entities.Style.PagesRange()
         {
             Text = new DataAccessLevel.Entities.Style.Text()
             {
                 Prefix = style.PagesRange.Text.Prefix,
                 Suffix = style.PagesRange.Text.Suffix,
                 Value  = style.PagesRange.Text.Value
             }
         },
         Publisher = new DataAccessLevel.Entities.Style.Publisher()
         {
             GroupPublisher = new DataAccessLevel.Entities.Style.GroupPublisher()
             {
                 TextPublishers = style.Publisher.GroupPublisher.TextPublishers.Select(text => new DataAccessLevel.Entities.Style.TextPublisher()
                 {
                     Prefix   = text.Prefix,
                     Suffix   = text.Suffix,
                     Value    = text.Value,
                     Variable = text.Variable
                 }).ToList()
             },
             YearDatePublisher = new DataAccessLevel.Entities.Style.YearDatePublisher()
             {
                 DatePublisher = new DataAccessLevel.Entities.Style.DatePublisher()
                 {
                     DatePartPublishers = style.Publisher.YearDatePublisher.DatePublisher.DatePartPublishers
                                          .Select(date => new DataAccessLevel.Entities.Style.DatePartPublisher()
                     {
                         NamePublisher = date.NamePublisher
                     }).ToList()
                 }
             }
         },
         Publishuniver = new DataAccessLevel.Entities.Style.PublishUniver()
         {
             GroupUniver = new DataAccessLevel.Entities.Style.GroupUniver()
             {
                 TextUnivers = style.Publishuniver.GroupUniver.TextUnivers
                               .Select(text => new DataAccessLevel.Entities.Style.TextUniver()
                 {
                     Prefix   = text.Prefix,
                     Suffix   = text.Suffix,
                     Value    = text.Value,
                     Variable = text.Variable
                 }).ToList()
             },
             YearDateUniver = new DataAccessLevel.Entities.Style.YearDateUniver()
             {
                 DateUniver = new DataAccessLevel.Entities.Style.DateUniver()
                 {
                     DatePartUnivers = style.Publishuniver.YearDateUniver.DateUniver.DatePartUnivers
                                       .Select(date => new DataAccessLevel.Entities.Style.DatePartUniver()
                     {
                         NameUniver = date.NameUniver
                     }).ToList()
                 }
             }
         },
         PublishVolume = new DataAccessLevel.Entities.Style.PublishVolume()
         {
             Text = new DataAccessLevel.Entities.Style.Text()
             {
                 Prefix = style.PublishVolume.Text.Prefix,
                 Suffix = style.PublishVolume.Text.Suffix,
                 Value  = style.PublishVolume.Text.Value
             }
         },
         TitleOfConference = new DataAccessLevel.Entities.Style.TitleOfConference()
         {
             Text = new DataAccessLevel.Entities.Style.Text()
             {
                 Prefix = style.TitleOfConference.Text.Prefix,
                 Suffix = style.TitleOfConference.Text.Suffix,
                 Value  = style.TitleOfConference.Text.Value
             }
         },
         Title = new DataAccessLevel.Entities.Style.Title()
         {
             Value = style.Title.Value,
             Text  = new DataAccessLevel.Entities.Style.Text()
             {
                 Prefix = style.Title.Text.Prefix,
                 Suffix = style.Title.Text.Suffix,
                 Value  = style.Title.Text.Value
             }
         },
         Webdoc = new DataAccessLevel.Entities.Style.Webdoc()
         {
             Group = new DataAccessLevel.Entities.Style.Group()
             {
                 Texts = style.Webdoc.Group.Texts.Select(text => new DataAccessLevel.Entities.Style.Text()
                 {
                     Prefix = text.Prefix,
                     Suffix = text.Suffix,
                     Value  = text.Value
                 }).ToList()
             }
         },
         YearDateStyle = new DataAccessLevel.Entities.Style.YearDate()
         {
             Date = new DataAccessLevel.Entities.Style.Date()
             {
                 DateParts = style.YearDateStyle.Date.DateParts.Select(date => new DataAccessLevel.Entities.Style.DatePart()
                 {
                     Name = date.Name
                 }).ToList()
             }
         }
     };
     await _database.Styles.Update(styleDB, style.Id);
 }
Beispiel #11
0
    // parses Dictionary file which should be a tab-delimited txt file (from excel)
    public void buildDicts()
    {
        text_file = Resources.Load <TextAsset>(file_name);
        string[] lines = text_file.text.Split(line_delim);
        string[] cols;
        int      i = 1;

        //read in root keywords
        while (true)
        {
            cols = lines[i].Split(col_delim);
            int    ind = 0;
            string key = cols[ind].Trim();
            if (key.CompareTo("END") == 0) //At end of root keywords
            {
                i += 2;                    //Skip example line
                break;
            }
            string type = cols[++ind].Trim();
            Spell  s    = createSpellFromType(type);
            s.name        = key;
            s.type        = type;
            s.description = cols[++ind].Trim().Replace("\"", string.Empty);
            s.animationID = cols[++ind].Trim();
            s.sfxID       = cols[++ind].Trim();
            int.TryParse(cols[++ind].Trim(), out s.power);
            float.TryParse(cols[++ind].Trim(), out s.cooldown);
            int.TryParse(cols[++ind].Trim(), out s.hitPercentage);
            int.TryParse(cols[++ind].Trim(), out s.critPercentage);
            int.TryParse(cols[++ind].Trim(), out s.elementEffectMod);
            string pattern = cols[++ind].Trim();
            if (pattern.Contains("A"))
            {
                s.targetData            = new TargetData(true);
                s.targetData.selfCenter = false;
                s.targetData.targeted   = false;
            }
            else
            {
                s.targetData = new TargetData(false);
                if (pattern.Contains("L"))
                {
                    s.targetData.enemyL = true;
                }
                if (pattern.Contains("M"))
                {
                    s.targetData.enemyM = true;
                }
                if (pattern.Contains("R"))
                {
                    s.targetData.enemyR = true;
                }
                if (pattern.Contains("l"))
                {
                    s.targetData.allyL = true;
                }
                if (pattern.Contains("m"))
                {
                    s.targetData.allyM = true;
                }
                if (pattern.Contains("r"))
                {
                    s.targetData.allyR = true;
                }
                if (pattern.Contains("S"))
                {
                    s.targetData.selfCenter = true;
                }
                if (pattern.Contains("T"))
                {
                    s.targetData.targeted = true;
                }
            }
            string buff = cols[++ind].Trim();
            if (!buff.Contains("N"))
            {
                s.buff = new BuffData();
                int level;
                if (type == "buff")
                {
                    level = s.power;
                }
                else
                {
                    level = 1;
                }
                if (buff.Contains("A"))
                {
                    s.buff.attackMod = -1 * level;
                }
                else if (buff.Contains("a"))
                {
                    s.buff.attackMod = level;
                }
                if (buff.Contains("D"))
                {
                    s.buff.defenseMod = -1 * level;
                }
                else if (buff.Contains("d"))
                {
                    s.buff.defenseMod = level;
                }
                if (buff.Contains("S"))
                {
                    s.buff.speedMod = -1 * level;
                }
                else if (buff.Contains("s"))
                {
                    s.buff.speedMod = level;
                }
                if (buff.Contains("H"))
                {
                    s.buff.accuracyMod = -1 * level;
                }
                else if (buff.Contains("h"))
                {
                    s.buff.accuracyMod = level;
                }
                if (buff.Contains("E"))
                {
                    s.buff.evasionMod = -1 * level;
                }
                else if (buff.Contains("e"))
                {
                    s.buff.evasionMod = level;
                }
                if (buff.Contains("U"))
                {
                    s.buff.vsElemMod[Elements.@null] = -1 * level;
                }
                else if (buff.Contains("u"))
                {
                    s.buff.vsElemMod[Elements.@null] = level;
                }
                if (buff.Contains("F"))
                {
                    s.buff.vsElemMod[Elements.fire] = -1 * level;
                }
                else if (buff.Contains("f"))
                {
                    s.buff.vsElemMod[Elements.fire] = level;
                }
                if (buff.Contains("I"))
                {
                    s.buff.vsElemMod[Elements.ice] = -1 * level;
                }
                else if (buff.Contains("i"))
                {
                    s.buff.vsElemMod[Elements.ice] = level;
                }
                if (buff.Contains("B"))
                {
                    s.buff.vsElemMod[Elements.volt] = -1 * level;
                }
                else if (buff.Contains("b"))
                {
                    s.buff.vsElemMod[Elements.volt] = level;
                }
            }
            int.TryParse(cols[++ind].Trim(), out s.buffPercentage);
            switch (cols[++ind].Trim().ToLower())
            {
            case "no_mods":
                s.modFlag = Spell.ModFlags.NO_MODIFICATION;
                break;

            case "no_elements":
                s.modFlag = Spell.ModFlags.NO_ELEMENT;
                break;

            case "no_styles":
                s.modFlag = Spell.ModFlags.NO_STYLE;
                break;

            case "no_targeting":
                s.modFlag = Spell.ModFlags.NO_TARGETING;
                break;

            default:
                s.modFlag = Spell.ModFlags.NORMAL;
                break;
            }
            spells.Add(key, s);
            i++;
        }
        //read in element keywords
        while (true)
        {
            cols = lines[i].Split(col_delim);
            int    ind = 0;
            string key = cols[ind].Trim();
            if (key.CompareTo("END") == 0)
            {
                i += 2;//Skip example line
                break;
            }
            ElementMod e = new ElementMod();
            e.name        = key;
            e.element     = Elements.fromString(cols[++ind].Trim());
            e.description = cols[++ind].Trim().Replace("\"", string.Empty);
            e.animationID = cols[++ind].Trim();
            e.sfxID       = cols[++ind].Trim();
            float.TryParse(cols[++ind].Trim(), out e.cooldownMod);
            float.TryParse(cols[++ind].Trim(), out e.cooldownModM);
            elements.Add(key, e);
            i++;
        }
        //Read in casting style keywords
        while (true)
        {
            cols = lines[i].Split(col_delim);
            int    ind = 0;
            string key = cols[ind].Trim();
            if (key.CompareTo("END") == 0)
            {
                return;
            }
            StyleMod s = new StyleMod();
            s.name = key;
            int.TryParse(cols[++ind].Trim(), out s.powerMod);
            s.description = cols[++ind].Trim().Replace("\"", string.Empty);
            s.animationID = cols[++ind].Trim();
            s.sfxID       = cols[++ind].Trim();
            float.TryParse(cols[++ind].Trim(), out s.powerModM);
            float.TryParse(cols[++ind].Trim(), out s.cooldownMod);
            float.TryParse(cols[++ind].Trim(), out s.cooldownModM);
            int.TryParse(cols[++ind].Trim(), out s.accMod);
            float.TryParse(cols[++ind].Trim(), out s.accModM);
            int.TryParse(cols[++ind].Trim(), out s.critMod);
            float.TryParse(cols[++ind].Trim(), out s.critModM);
            int.TryParse(cols[++ind].Trim(), out s.statusEffectChanceMod);
            float.TryParse(cols[++ind].Trim(), out s.statusEffectChanceModM);
            string[] pattern = cols[++ind].Trim().Split(',');
            if (pattern[0].Contains("N"))
            {
                s.isTarget = false;
            }
            else
            {
                s.targets = TargetMod.createFromString(pattern[0].Trim('"'), pattern);
            }
            styles.Add(key, s);
            i++;
        }
    }