示例#1
0
        private void HandleSubParty(XElement el, ECulture culture)
        {
            string name = "";

            if (el.Name == "SubParty")
            {
                foreach (var att in el.Attributes())
                {
                    name = att.Value.ToString();
                }
            }

            foreach (var att in el.Attributes())
            {
                foreach (var ele in el.Elements())
                {
                    if (ele.Name == "Character")
                    {
                        if (!SubpartyTable.Instance.Table[culture].ContainsKey(name))
                        {
                            SubpartyTable.Instance.Table[culture].Add((name), new List <SubPartyParam>());
                        }

                        var csv    = ele.Value.Split(',');
                        var values = new List <string>();
                        for (int i = 0; i < csv.Length; i++)
                        {
                            values.Add(csv[i]);
                        }
                        if (values.Count > 2)
                        {
                            var param = new SubPartyParam();

                            double    difficulty = 0;
                            EStartCol row        = EStartCol.None;

                            if (double.TryParse(values[SubPartiesXMLIndexes.DIFFICULTY], out difficulty))
                            {
                                param.Difficulty = difficulty;
                            }
                            param.Name = values[SubPartiesXMLIndexes.NAME];
                            if (EnumUtil <EStartCol> .TryGetEnumValue(values[SubPartiesXMLIndexes.ROW], ref row))
                            {
                                param.Row = row;
                            }
                            SubpartyTable.Instance.Table[culture][name].Add(param);
                        }
                    }
                }
            }
        }
示例#2
0
        public CTile GetTileForRow(bool lParty, EStartCol col)
        {
            int rowInd = -1;
            int colInd = -1;

            if (!lParty)
            {
                if (col == EStartCol.Three)
                {
                    colInd = this._map.GetLastCol() - 4;
                }
                else if (col == EStartCol.Two)
                {
                    colInd = this._map.GetLastCol() - 5;
                }
                else
                {
                    colInd = this._map.GetLastCol() - 6;
                }
            }
            else
            {
                if (col == EStartCol.Three)
                {
                    colInd = this._map.GetFirstCol() + 3;
                }
                else if (col == EStartCol.Two)
                {
                    colInd = this._map.GetFirstCol() + 4;
                }
                else
                {
                    colInd = this._map.GetFirstCol() + 5;
                }
            }

            rowInd = this._map.GetMidRow();
            var key = new Pair <int, int>(colInd, rowInd);

            for (int i = 0; !this._tileDict.ContainsKey(key) || this._tileDict[key].Current != null; i++)
            {
                int counter = i / 2;
                if (i % 2 == 1)
                {
                    counter *= -1;
                }
                if (rowInd + counter > this._map.GetLastCol() - 1)
                {
                    i = 0;
                    if (lParty)
                    {
                        colInd--;
                    }
                    else
                    {
                        colInd++;
                    }
                }
                else if (rowInd + counter < 0)
                {
                    i = 0;
                    if (lParty)
                    {
                        colInd--;
                    }
                    else
                    {
                        colInd++;
                    }
                }
                key = new Pair <int, int>(colInd, rowInd + counter);
            }
            return(this._tileDict[key]);
        }