Ejemplo n.º 1
0
        public override void OnEndGame(End type)
        {
            Game.Instance.isFinish = true;
            switch (type)
            {
                case End.ABANDON:
                    OnAbandon();
                    break;
                case End.TIME:
                    OnPointMax();
                    break;
            }

            if (PhotonNetwork.room.visible)
            {
                calculatePoint();
                if (this.win)
                    Sync(type != End.ABANDON);
                points_text += "" + score;
            }
            else
            {
                points_text = "Partie privee";
            }

            status.text = status_text;
            points.text = points_text;
            content.text = content_text;

            status.color = status_color;
            panel.SetActive(true);
        }
Ejemplo n.º 2
0
        private void Terminate(End end)
        {
            var counts =
                wordCount.Keys
                    .OrderBy(w => w)
                    .Select(w => String.Format("{0}: {1}", w, wordCount[w]));

            foreach (var count in counts)
                next.Tell(count);

            next.Tell(end);
        }
Ejemplo n.º 3
0
        public override void Parse(System.Xml.XmlNode dom)
        {
            this.Name = dom.Attributes["Name"].Value;

            foreach (XmlNode n in dom.ChildNodes)
            {
                if (n.Name == "End")
                {
                    var end = new End();
                    end.Parse(n);
                    end.Parent = this;
                    this.Ends.Add(end.Role, end);
                }

            }

            base.Parse(dom);
        }
    public void AnalyzeDrivePlaysList(List<Plays> DrivePlays, Start StartDrive, End EndDrive)
    {
        List<double> expectedPointsList = new List<double>();
        List<double> epChangeList = new List<double>();

        foreach (Plays play in DrivePlays)
        {//get rid of 0 kickoff, can have 0 but will fix later
            if (play.MarkovExpPts != 0) {
                expectedPointsList.Add(play.MarkovExpPts);
            }
        }

        for (int i = 0; i < expectedPointsList.Count; ++i) {
            if (i != 0)
            {
                //vauleNow - ValueLast
                double epChange = (expectedPointsList[i]) - (expectedPointsList[i - 1]);
                epChangeList.Add(epChange);
            }
        }
    }
Ejemplo n.º 5
0
        public override void Parse(System.Xml.XmlNode dom)
        {
            this.Name = dom.Attributes["Name"].Value;

            foreach (XmlNode n in dom.ChildNodes)
            {
                if (n.Name == "End")
                {
                    var end = new End();
                    end.Parse(n);
                    end.Parent = this;
                    this.Ends.Add(end.Role, end);
                }
                else if (n.Name == "ReferentialConstraint")
                {
                    var referentialConstraint = new ReferentialConstraint();
                    referentialConstraint.Parse(n);
                    referentialConstraint.Parent = this;
                    this.ReferentialConstraint = referentialConstraint;
                }
            }

            base.Parse(dom);
        }
        public override IEnumerable <JToken> ExecuteFilter(JToken root, IEnumerable <JToken> current, bool errorWhenNoMatch)
        {
            if (Step == 0)
            {
                throw new JsonException("Step cannot be zero.");
            }

            foreach (JToken t in current)
            {
                if (t is JArray a)
                {
                    // set defaults for null arguments
                    int stepCount  = Step ?? 1;
                    int startIndex = Start ?? ((stepCount > 0) ? 0 : a.Count - 1);
                    int stopIndex  = End ?? ((stepCount > 0) ? a.Count : -1);

                    // start from the end of the list if start is negative
                    if (Start < 0)
                    {
                        startIndex = a.Count + startIndex;
                    }

                    // end from the start of the list if stop is negative
                    if (End < 0)
                    {
                        stopIndex = a.Count + stopIndex;
                    }

                    // ensure indexes keep within collection bounds
                    startIndex = Math.Max(startIndex, (stepCount > 0) ? 0 : int.MinValue);
                    startIndex = Math.Min(startIndex, (stepCount > 0) ? a.Count : a.Count - 1);
                    stopIndex  = Math.Max(stopIndex, -1);
                    stopIndex  = Math.Min(stopIndex, a.Count);

                    bool positiveStep = (stepCount > 0);

                    if (IsValid(startIndex, stopIndex, positiveStep))
                    {
                        for (int i = startIndex; IsValid(i, stopIndex, positiveStep); i += stepCount)
                        {
                            yield return(a[i]);
                        }
                    }
                    else
                    {
                        if (errorWhenNoMatch)
                        {
                            throw new JsonException("Array slice of {0} to {1} returned no results.".FormatWith(CultureInfo.InvariantCulture,
                                                                                                                Start != null ? Start.GetValueOrDefault().ToString(CultureInfo.InvariantCulture) : "*",
                                                                                                                End != null ? End.GetValueOrDefault().ToString(CultureInfo.InvariantCulture) : "*"));
                        }
                    }
                }
                else
                {
                    if (errorWhenNoMatch)
                    {
                        throw new JsonException("Array slice is not valid on {0}.".FormatWith(CultureInfo.InvariantCulture, t.GetType().Name));
                    }
                }
            }
        }
Ejemplo n.º 7
0
 public override string ToString()
 {
     return("SelectionRange: Start: " + Start.ToSafeString() + ", End: " + End.ToSafeString());
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Returns a hash code for this instance.
 /// </summary>
 /// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.</returns>
 public override int GetHashCode()
 {
     return((StartDefined ? Start.GetHashCode() * 467 : 0) + (EndDefined ? End.GetHashCode() * 487 : 0));
 }
Ejemplo n.º 9
0
 void OnReceiveEnd(End end)
 {
     this.OnReceiveCloseCommand("R:END", end.Error);
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Expands this range out to the next parent shared by the start and end points
        /// if there there are no non-empty text elements between them.
        /// </summary>
        /// <returns></returns>
        public bool MoveOutwardIfNo(RangeFilter rangeFilter)
        {
            MarkupRange newRange = MarkupServices.CreateMarkupRange();

            IHTMLElement sharedParent = GetSharedParent(Start, End);

            // If share a common parent, we will take the shared parent's parent so we can see if we want to grab
            // all the html inside of it, unless the shared parent is the body element, in which case we don't want to
            // expand outward anymore
            if (Start.CurrentScope == sharedParent && End.CurrentScope == sharedParent && !(sharedParent is IHTMLBodyElement))
            {
                sharedParent = sharedParent.parentElement;
            }

            //expand to the inside of the shared parent first.  If this matches the current placement
            //of the pointers, then expand to the outside of the parent. This allows the outter selection
            //to grow incrementally in such a way as to allow the shared parent to be tested between
            //each iteration of this operation.
            newRange.Start.MoveAdjacentToElement(sharedParent, _ELEMENT_ADJACENCY.ELEM_ADJ_AfterBegin);
            newRange.End.MoveAdjacentToElement(sharedParent, _ELEMENT_ADJACENCY.ELEM_ADJ_BeforeEnd);
            if (newRange.IsEmpty() || newRange.Start.IsRightOf(Start) || newRange.End.IsLeftOf(End))
            {
                newRange.Start.MoveAdjacentToElement(sharedParent, _ELEMENT_ADJACENCY.ELEM_ADJ_BeforeBegin);
                newRange.End.MoveAdjacentToElement(sharedParent, _ELEMENT_ADJACENCY.ELEM_ADJ_AfterEnd);
            }

            if (!rangeFilter(newRange.Start, Start) && !rangeFilter(End, newRange.End) &&
                !(Start.IsEqualTo(newRange.Start) && End.IsEqualTo(newRange.End)))
            {
                Start.MoveToPointer(newRange.Start);
                End.MoveToPointer(newRange.End);
                return(true);
            }
            else
            {
                //span the start and end pointers as siblings by finding the parents of start and end
                //pointers that are direct children of the sharedParent
                IHTMLElement child = GetOuterMostChildOfParent(Start, true, sharedParent);
                if (child != null)
                {
                    newRange.Start.MoveAdjacentToElement(child, _ELEMENT_ADJACENCY.ELEM_ADJ_BeforeBegin);
                }
                else
                {
                    newRange.Start = Start;
                }

                child = GetOuterMostChildOfParent(End, false, sharedParent);
                if (child != null)
                {
                    newRange.End.MoveAdjacentToElement(child, _ELEMENT_ADJACENCY.ELEM_ADJ_AfterEnd);
                }
                else
                {
                    newRange.End = End;
                }

                if (!rangeFilter(newRange.Start, Start) && !rangeFilter(End, newRange.End) &&
                    !(Start.IsEqualTo(newRange.Start) && End.IsEqualTo(newRange.End)))
                {
                    Start.MoveToPointer(newRange.Start);
                    End.MoveToPointer(newRange.End);
                    return(true);
                }
                else
                {
                    //the range didn't change, so return false.
                    return(false);
                }
            }
        }
 public IActionResult Create(End end)
 {
     _endDAO.Create(end);
     return(Created("", end));
 }
Ejemplo n.º 12
0
 public bool TestWin()
 {
     if(_CacNuocDaDi.Count == 64)
     {
         _End = End.NotWin;
         
         return true;
     }
     foreach (OCo oco in _CacNuocDaDi)
     {
         if (DuyetDoc(oco.Row, oco.Col, oco.Own) || DuyetNgang(oco.Row, oco.Col, oco.Own) || DuyetCheoXuoi(oco.Row, oco.Col, oco.Own) || DuyetCheoNguoc(oco.Row, oco.Col, oco.Own))
         {
             _End = oco.Own == 1 ? End.Player1 : End.Player2;
            
             return true;
         }
         
     }
     
     return false;
 }
Ejemplo n.º 13
0
		public override void OnEndGame(End type) {
			SaveLoad.save_replay (replay);
		}
    public void DeserializeDrives(List<NFLEPMarkov> EPList, int totalDrives, JObject drives)
    {
        List<Plays> PlayAnalyzer = new List<Plays>();
        Start sDrive = new Start();
        End eDrive = new End();
        //Goes through each drive in gameID
        for (int i = 1; i <= totalDrives; ++i) {
            //Is the current drive aka 1,2,3,etc.
            var currentDrive = (JObject)drives[i.ToString()];

            if (currentDrive != null) {

                //Not sure the best way to do this, but the Plays and Players aren't Deserializing correctly.
                //I could write a custom deserializer or jtokenreader? but not sure how or how long that would take.
                //Work around is I can parse it "manually", using the results and keys that are different for every game.

                //throw into using, IDisposable?
                JsonSerializer serializer = new JsonSerializer();
                //Store currentDrive into Drives object
                //Drives test = currentDrive.ToObject(typeof(Drives));
                Drives storeCurrentDrive = (Drives)serializer.Deserialize(new JTokenReader(currentDrive), typeof(Drives));

                //taking the plays out of the currentDrive and storing into JObject
                JObject playsInCurrentDrive = (JObject)currentDrive["plays"];
                //taking the key of each individual play and storing into a list
                IList<string> playsKeys = playsInCurrentDrive.Properties().Select(p => p.Name).ToList();

                //going through each key of the ind. play and taking out the play, players and storing into objects
                foreach (string key in playsKeys) {
                    //storing the play into play object, need the unique key for each play to read
                    Plays play = (Plays)serializer.Deserialize(new JTokenReader(playsInCurrentDrive[key]), typeof(Plays));

                    if (play.Down != 0) { //Means Kickoff  edit around that will have to figure out what to do with those
                        int convertedYardsToTD = convertToIntYardtoTD(play.Yrdln, play.Posteam);
                        NFLEPMarkov tempMarkov = getExpectedPointsForPlay(EPList, play.Down, play.Ydstogo, convertedYardsToTD); //Down,YardsToGo,YardLine(in 1-99 format)
                        play.EPState = tempMarkov.State;
                        play.MarkovExpPts = tempMarkov.Markov;
                    }

                    JObject playersInCurrentPlay = (JObject)currentDrive["plays"][key]["players"];

                    //Getting the key (semi-unique, it's the playerID) and storing in a list
                    IList<string> playersKeys = playersInCurrentPlay.Properties().Select(p => p.Name).ToList();
                    //Going through each key and storing the players into players list
                    foreach (string playerKey in playersKeys) {
                        //storing the playerID
                        string playerID = playerKey;
                        //Putting the current play players into a list
                        IList<Players> PlayersList = serializer.Deserialize<IList<Players>>(new JTokenReader(playersInCurrentPlay[playerKey]));
                    }
                    sDrive = serializer.Deserialize<Start>(new JTokenReader(currentDrive["start"]));
                    eDrive = serializer.Deserialize<End>(new JTokenReader(currentDrive["end"]));
                    PlayAnalyzer.Add(play);
                }
                //another way to do it, didnt work as well
                //JEnumerable<JToken> playsContainer = results[gameID]["drives"][i.ToString()]["plays"].Children();

                //Fill in ExpPt Data for start and end drive

                Plays startPlay = PlayAnalyzer.First();
                sDrive.expectedPts = startPlay.MarkovExpPts;
                Plays endPlay = PlayAnalyzer.Last();
                eDrive.expectedPts = endPlay.MarkovExpPts;
                if (startPlay == null || endPlay == null) { throw new NullReferenceException("StartPlay or EndPlay is null"); }
                    AnalyzeDrivePlaysList(PlayAnalyzer, sDrive, eDrive);  //do start and end here
            }
        }
    }
Ejemplo n.º 15
0
        protected virtual void Create(Dto src, string user, IDbSession session)
        {
            Start = src.Start ?? MinimumDate;
            End   = src.End ?? MaximumDate;
            var set   = session.DbContext.Set <T>();
            var items = set.Where(SeriesExpression).ToArray();

            var replacing = items.Where(args => Start <= args.Start && args.End <= End);

            set.RemoveRange(replacing);

            var front = items.Where(args => args.Start < Start && args.End >= Start && args.End <= End);

            foreach (var item in front)
            {
                if (CanMerge(item))
                {
                    set.Remove(item);
                    if (item.Start < Start)
                    {
                        Start = item.Start;
                    }
                }
                else
                {
                    item.End = Start.AddDays(-1);
                }
            }

            var back = items.Where(args => Start <= args.Start && args.Start <= End && End < args.End);

            foreach (var item in back)
            {
                if (CanMerge(item))
                {
                    set.Remove(item);
                    if (item.End > End)
                    {
                        End = item.End;
                    }
                }
                else
                {
                    item.Start = End.AddDays(1);
                }
            }

            var overlap = items.Where(args => args.Start <Start && args.End> End);

            foreach (var item in overlap)
            {
                if (CanMerge(item))
                {
                    set.Remove(item);
                    if (item.Start < Start)
                    {
                        Start = item.Start;
                    }
                    if (item.End > End)
                    {
                        End = item.End;
                    }
                }
                else
                {
                    var clone = item.Clone(user);
                    item.End    = Start.AddDays(-1);
                    clone.Start = End.AddDays(1);
                    set.Add(clone);
                }
            }
            base.Create(user);
        }
Ejemplo n.º 16
0
        public static void SerializeDirToPak(string dir, string pakfile)
        {
            string[] allFiles = recursiveGetFiles(dir, "");

            List<Dir> dirEntryList = new List<Dir>();

            using (FormattedWriter fw = new FormattedWriter(pakfile)) {
                // Write files
                foreach (var file in allFiles) {
                    fw.Write(new Signature() { signature = stringFileHeader2 });
                    File f = new File();
                    byte[] bytes = System.IO.File.ReadAllBytes(Path.Combine(dir, file));
                    byte[] compressed = decryptBytesWithTable(ZlibCodecCompress(bytes), 0x3ff, 1, table2);
                    f.compressedSize = (uint)compressed.Length;
                    f.compressionMethod = 8;
                    CRC32 dataCheckSum = new CRC32();
                    f.crc = dataCheckSum.GetCrc32(new MemoryStream(bytes));
                    f.data = compressed;
                    f.extractSystem = 0;
                    f.extractVersion = 20;
                    f.extraField = new byte[0];
                    f.extraFieldLength = 0;
                    f.filename = Encoding.UTF8.GetBytes(file);
                    f.filenameLength = (ushort)f.filename.Length;
                    f.generalPurposeFlagBits = 0;
                    f.lastModDate = 0;
                    f.lastModTime = 0;
                    f.uncompressedSize = (uint)bytes.Length;
                    fw.Write(f);

                    Dir d = new Dir();
                    d.comment = new byte[0];
                    d.commentLength = 0;
                    d.compressedSize = f.compressedSize;
                    d.compressType = f.compressionMethod;
                    d.crc = f.crc;
                    d.createSystem = f.extractSystem;
                    d.createVersion = f.extractVersion;
                    d.date = f.lastModDate;
                    d.diskNumberStart = 0;
                    d.externalFileAttributes = 33;
                    d.extractSystem = f.extractSystem;
                    d.extractVersion = f.extractVersion;
                    d.extraField = new byte[0];
                    d.extraFieldLength = 0;
                    d.filename = f.filename;
                    d.filenameLength = f.filenameLength;
                    d.flagBits = f.generalPurposeFlagBits;
                    d.internalFileAttributes = 0;
                    d.localHeaderOffset = 0;
                    d.time = f.lastModTime;
                    d.uncompressedSize = f.uncompressedSize;

                    dirEntryList.Add(d);
                }

                var dirEntryListStartPos = fw.BaseStream.BaseStream.Position;
                foreach (var d in dirEntryList) {
                    fw.Write(new Signature() { signature = stringCentralDir2 });
                    fw.Write(d);
                }
                var dirEntryListEndPos = fw.BaseStream.BaseStream.Position;

                End e = new End();
                e.byteSizeOfCentralDirectory = (uint)(dirEntryListEndPos - dirEntryListStartPos);
                e.centralDirRecordsOnDisk = (short)dirEntryList.Count;
                e.centralDirStartDisk = 0;
                e.comment = new byte[0];
                e.commentLength = 0;
                e.diskNumber = 0;
                e.offsetOfStartOfCentralDirectory = (uint)dirEntryListStartPos;
                e.totalNumOfCentralDirRecords = (short)dirEntryList.Count;

                fw.Write(new Signature() { signature = stringEndArchive2 });
                fw.Write(e);
            }
        }
Ejemplo n.º 17
0
 public override string ToString()
 {
     return(Start.ToString() + "  " + End.ToString());
 }
Ejemplo n.º 18
0
        public CrtSequence(IStreamReader reader)
            : base(reader)
        {
            // ChartFormat
            //   Begin
            //     (Bar / Line / (BopPop [BopPopCustom]) / Pie / Area / Scatter / Radar / RadarArea / Surf)
            //     CrtLink [SeriesList] [Chart3d] [LD] [2DROPBAR] *4(CrtLine LineFormat) *2DFTTEXT [DataLabExtContents] [SS] *4SHAPEPROPS
            //   End

            // ChartFormat
            this.ChartFormat = (ChartFormat)BiffRecord.ReadRecord(reader);

            // Begin
            this.Begin = (Begin)BiffRecord.ReadRecord(reader);

            // (Bar / Line / (BopPop [BopPopCustom]) / Pie / Area / Scatter / Radar / RadarArea / Surf)
            this.ChartType = BiffRecord.ReadRecord(reader);
            if (BiffRecord.GetNextRecordType(reader) == RecordType.BopPopCustom)
            {
                this.BopPopCustom = (BopPopCustom)BiffRecord.ReadRecord(reader);
            }

            // CrtLink
            this.CrtLink = (CrtLink)BiffRecord.ReadRecord(reader);

            // [SeriesList]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.SeriesList)
            {
                this.SeriesList = (SeriesList)BiffRecord.ReadRecord(reader);
            }

            // [Chart3d]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.Chart3d)
            {
                this.Chart3d = (Chart3d)BiffRecord.ReadRecord(reader);
            }

            // [LD]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.Legend)
            {
                this.LdSequence = new LdSequence(reader);
            }

            // [2DROPBAR]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.DropBar)
            {
                this.DropBarSequence = new DropBarSequence[2];
                for (int i = 0; i < 2; i++)
                {
                    this.DropBarSequence[i] = new DropBarSequence(reader);
                }
            }

            //*4(CrtLine LineFormat)
            this.CrtLineGroups = new List <CrtLineGroup>();
            while (BiffRecord.GetNextRecordType(reader) == RecordType.CrtLine)
            {
                this.CrtLineGroups.Add(new CrtLineGroup(reader));
            }

            //*2DFTTEXT
            this.DftTextSequences = new List <DftTextSequence>();
            while (BiffRecord.GetNextRecordType(reader) == RecordType.DataLabExt ||
                   BiffRecord.GetNextRecordType(reader) == RecordType.DefaultText)
            {
                this.DftTextSequences.Add(new DftTextSequence(reader));
            }

            //[DataLabExtContents]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.DataLabExtContents)
            {
                this.DataLabExtContents = (DataLabExtContents)BiffRecord.ReadRecord(reader);
            }

            //[SS]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.DataFormat)
            {
                this.SsSequence = new SsSequence(reader);
            }

            //*4SHAPEPROPS
            this.ShapePropsSequences = new List <ShapePropsSequence>();
            while (BiffRecord.GetNextRecordType(reader) == RecordType.ShapePropsStream)
            {
                this.ShapePropsSequences.Add(new ShapePropsSequence(reader));
            }

            if (BiffRecord.GetNextRecordType(reader) == RecordType.CrtMlFrt)
            {
                CrtMlfrtSequence crtmlfrtseq = new CrtMlfrtSequence(reader);
            }


            this.End = (End)BiffRecord.ReadRecord(reader);
        }
Ejemplo n.º 19
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((Start != null ? Start.GetHashCode() : 0) * 397) ^ (End != null ? End.GetHashCode() : 0));
     }
 }
Ejemplo n.º 20
0
 public override string ToString()
 {
     return("L" + End.ToSvgString());
 }
Ejemplo n.º 21
0
 public void StartEndDrive(List<Plays> PlaysinCD, Start strDrive, End endDrive) {
     //Figure out later
 }
Ejemplo n.º 22
0
 public Wall Clone()
 {
     return(new Wall(Start.Clone(), End.Clone(), IsHorizontal));
 }
Ejemplo n.º 23
0
 public Line DeepCopy()
 {
     return(new Line(Start.DeepCopy(), End.DeepCopy()));
 }
Ejemplo n.º 24
0
 public bool Equals(Line other)
 {
     return(Start.Equals(other.Start) && End.Equals(other.End));
 }
Ejemplo n.º 25
0
 protected bool Equals(Line other)
 {
     return(Start.Equals(other.Start) && End.Equals(other.End));
 }
Ejemplo n.º 26
0
        public override string ToString()
        {
            var workers = Workers.Aggregate("", (acc, w) => acc + " : " + w).Substring(3);

            return($"{Name}  {Start:MM/dd/yyyy}-{(IsCompleted ? End.ToString(@"MM/dd/yyyy") : "")} ({Cost:F2}) {workers}");
        }
Ejemplo n.º 27
0
    public void selectFicha()
    {
        bool onlyOne = false;

        for (int i = 0; i < Constants.Map.w; i++)
        {
            for (int j = 0; j < Constants.Map.h; j++)
            {
                if (!(i % 2 == 0 && j == Constants.Map.h - 1) && !onlyOne)                                        //condicio basica del mapa + nomes una escollida
                {
                    if (selectorMap[i][j].gameObject.GetComponent <Trigger>().isTriggered)                        // esta trigerejada pel ratoli
                    {
                        if (pathCount < Constants.Map.path_size && localMap[i][j].type == Ficha.Ficha_Type.VACIO) // te que estar vuida i tenir path disponible
                        {
                            bool auxBool = true;
                            if (pathCount > 0) //
                            {
                                auxBool = isTouching(localPath[localPath.Count - 1], localMap[i][j]);
                            }
                            if (auxBool)
                            {
                                Vector2 auxPos = localMap[i][j].position; //guardes posicio, destrueixes objecte
                                Object.Destroy(localMap[i][j].gameObject);
                                if (pathCount == 0)                       //decideixes quin nou objecte el substituira
                                {
                                    localMap[i][j] = new Start(pathFolder, true);
                                }
                                else if (pathCount == Constants.Map.path_size - 1)
                                {
                                    localMap[i][j] = new End(pathFolder, true);
                                }
                                else
                                {
                                    localMap[i][j] = new Camino(pathFolder, true);
                                }
                                localMap[i][j].position = auxPos; //actualitzes posicio e index
                                localMap[i][j].i        = i; localMap[i][j].j = j;
                                localPath.Add(localMap[i][j]);    //afegeix a Path
                                pathCount++;
                                localMap[i][j].setPathIndex(localPath.Count - 1);
                                onlyOne = true;
                            }
                        }
                    }
                }
            }
        }
        if (pathCount == Constants.Map.path_size)//aqui predeterminem el del enemic
        {
            Vector2 auxPos = othersMap[0][1][3].position; Object.Destroy(othersMap[0][1][3].gameObject);
            othersMap[0][1][3] = new Start(pathFolder, false); othersPath[0].Add(othersMap[0][1][3]); othersMap[0][1][3].position = auxPos;

            auxPos             = othersMap[0][2][2].position; Object.Destroy(othersMap[0][2][2].gameObject);
            othersMap[0][2][2] = new Camino(pathFolder, false); othersPath[0].Add(othersMap[0][2][2]); othersMap[0][2][2].position = auxPos;

            auxPos             = othersMap[0][3][2].position; Object.Destroy(othersMap[0][3][2].gameObject);
            othersMap[0][3][2] = new Camino(pathFolder, false); othersPath[0].Add(othersMap[0][3][2]); othersMap[0][3][2].position = auxPos;

            auxPos             = othersMap[0][4][2].position; Object.Destroy(othersMap[0][4][2].gameObject);
            othersMap[0][4][2] = new Camino(pathFolder, false); othersPath[0].Add(othersMap[0][4][2]); othersMap[0][4][2].position = auxPos;

            auxPos             = othersMap[0][5][3].position; Object.Destroy(othersMap[0][5][3].gameObject);
            othersMap[0][5][3] = new Camino(pathFolder, false); othersPath[0].Add(othersMap[0][5][3]); othersMap[0][5][3].position = auxPos;

            auxPos             = othersMap[0][6][3].position; Object.Destroy(othersMap[0][6][3].gameObject);
            othersMap[0][6][3] = new Camino(pathFolder, false); othersPath[0].Add(othersMap[0][6][3]); othersMap[0][6][3].position = auxPos;

            auxPos             = othersMap[0][7][4].position; Object.Destroy(othersMap[0][7][4].gameObject);
            othersMap[0][7][4] = new Camino(pathFolder, false); othersPath[0].Add(othersMap[0][7][4]); othersMap[0][7][4].position = auxPos;

            auxPos             = othersMap[0][8][4].position; Object.Destroy(othersMap[0][8][4].gameObject);
            othersMap[0][8][4] = new Camino(pathFolder, false); othersPath[0].Add(othersMap[0][8][4]); othersMap[0][8][4].position = auxPos;

            auxPos             = othersMap[0][9][4].position; Object.Destroy(othersMap[0][9][4].gameObject);
            othersMap[0][9][4] = new Camino(pathFolder, false); othersPath[0].Add(othersMap[0][9][4]); othersMap[0][9][4].position = auxPos;

            auxPos = othersMap[0][10][3].position; Object.Destroy(othersMap[0][10][3].gameObject);
            othersMap[0][10][3] = new Camino(pathFolder, false); othersPath[0].Add(othersMap[0][10][3]); othersMap[0][10][3].position = auxPos;

            auxPos = othersMap[0][11][3].position; Object.Destroy(othersMap[0][11][3].gameObject);
            othersMap[0][11][3] = new Camino(pathFolder, false); othersPath[0].Add(othersMap[0][11][3]); othersMap[0][11][3].position = auxPos;

            auxPos = othersMap[0][12][2].position; Object.Destroy(othersMap[0][12][2].gameObject);
            othersMap[0][12][2] = new Camino(pathFolder, false); othersPath[0].Add(othersMap[0][12][2]); othersMap[0][12][2].position = auxPos;

            auxPos = othersMap[0][13][3].position; Object.Destroy(othersMap[0][13][3].gameObject);
            othersMap[0][13][3] = new Camino(pathFolder, false); othersPath[0].Add(othersMap[0][13][3]); othersMap[0][13][3].position = auxPos;

            auxPos = othersMap[0][13][4].position; Object.Destroy(othersMap[0][13][4].gameObject);
            othersMap[0][13][4] = new Camino(pathFolder, false); othersPath[0].Add(othersMap[0][13][4]); othersMap[0][13][4].position = auxPos;

            auxPos = othersMap[0][13][5].position; Object.Destroy(othersMap[0][13][5].gameObject);
            othersMap[0][13][5] = new End(pathFolder, false); othersPath[0].Add(othersMap[0][13][5]); othersMap[0][13][5].position = auxPos;

            for (int i = 0; i < Constants.Map.w; i++)
            {
                for (int j = 0; j < Constants.Map.h; j++)
                {
                    if (!(i % 2 == 0 && j == Constants.Map.h - 1))
                    {
                        othersMap[0][i][j].i = i; othersMap[0][i][j].j = j;
                    }
                }
            }
            for (int i = 0; i < Constants.Map.path_size; i++)
            {
                othersPath[0][i].setPathIndex(i);
            }

            localPathFolder.AddComponent <LineRenderer>();
            localPathFolder.GetComponent <LineRenderer>().startWidth    = localPathFolder.GetComponent <LineRenderer>().endWidth = Constants.Map.Local.path_width;
            localPathFolder.GetComponent <LineRenderer>().material      = new Material(Shader.Find("Sprites/Default"));
            localPathFolder.GetComponent <LineRenderer>().startColor    = new Color(0, 0, 1);
            localPathFolder.GetComponent <LineRenderer>().endColor      = new Color(1, 1, 0);
            localPathFolder.GetComponent <LineRenderer>().positionCount = Constants.Map.path_size;

            othersPathFolder.AddComponent <LineRenderer>();
            othersPathFolder.GetComponent <LineRenderer>().startWidth    = othersPathFolder.GetComponent <LineRenderer>().endWidth = Constants.Map.Others.path_width;
            othersPathFolder.GetComponent <LineRenderer>().material      = new Material(Shader.Find("Sprites/Default"));
            othersPathFolder.GetComponent <LineRenderer>().startColor    = new Color(0, 0, 1);
            othersPathFolder.GetComponent <LineRenderer>().endColor      = new Color(1, 1, 0);
            othersPathFolder.GetComponent <LineRenderer>().positionCount = Constants.Map.path_size;

            Vector3[] localPoints  = new Vector3[Constants.Map.path_size];
            Vector3[] othersPoints = new Vector3[Constants.Map.path_size];

            for (int i = 0; i < Constants.Map.path_size; i++)
            {
                localPath[i].gameObject.transform.SetParent(localPathFolder.transform);
                othersPath[0][i].gameObject.transform.SetParent(othersPathFolder.transform);

                localPoints[i]  = new Vector3(localPath[i].position.x, localPath[i].position.y, Constants.Layers.zPath);
                othersPoints[i] = new Vector3(othersPath[0][i].position.x, othersPath[0][i].position.y, Constants.Layers.zPath);
            }
            localPathFolder.GetComponent <LineRenderer>().SetPositions(localPoints);
            othersPathFolder.GetComponent <LineRenderer>().SetPositions(othersPoints);



            created = true;
        }
    }
Ejemplo n.º 28
0
 public void StringifyDate()
 {
     Guide = string.Empty;
     Date = string.Empty;
     Date += Start.HasValue ? $"{Start.GetValueOrDefault().ToShortDateString()} : {Start.GetValueOrDefault().ToShortTimeString()}" : string.Empty;
     Date += " - ";
     Date += End.HasValue ? $"{End.GetValueOrDefault().ToShortDateString()} : {End.GetValueOrDefault().ToShortTimeString()}" : string.Empty;
 }
Ejemplo n.º 29
0
 public override string ToString() => $"\tId: {Id} - Name: {Name} - Start: {Start.ToUniversalTime().ToString("O")} - End: {End.ToUniversalTime().ToString("O")}";
Ejemplo n.º 30
0
 override public string ToString()
 {
     return(Task + "#" + Start.ToString() + "#" + End.ToString());
 }
Ejemplo n.º 31
0
            public static Element UpdateElement(string line)
            {
                line = (line + "                                                                                ").Substring(0, 80);
                if (Header.IsHeader(line))
                {
                    return(Header.FromString(line));                        // Title Section
                }
                if (Title.IsTitle(line))
                {
                    return(Title.FromString(line));                         // Title Section
                }
                if (Compnd.IsCompnd(line))
                {
                    return(Compnd.FromString(line));                        // Title Section
                }
                if (Source.IsSource(line))
                {
                    return(Source.FromString(line));                        // Title Section
                }
                if (Keywds.IsKeywds(line))
                {
                    return(Keywds.FromString(line));                        // Title Section
                }
                if (Expdta.IsExpdta(line))
                {
                    return(Expdta.FromString(line));                        // Title Section
                }
                if (Nummdl.IsNummdl(line))
                {
                    return(Nummdl.FromString(line));                        // Title Section
                }
                if (Author.IsAuthor(line))
                {
                    return(Author.FromString(line));                        // Title Section
                }
                if (Revdat.IsRevdat(line))
                {
                    return(Revdat.FromString(line));                        // Title Section
                }
                if (Jrnl.IsJrnl(line))
                {
                    return(Jrnl.FromString(line));                          // Title Section
                }
                if (Remark.IsRemark(line))
                {
                    return(Remark.FromString(line));                        // Title Section
                }
                if (Seqres.IsSeqres(line))
                {
                    return(Seqres.FromString(line));                        // Primary Structure Section
                }
                if (Seqadv.IsSeqadv(line))
                {
                    return(Seqadv.FromString(line));                        // Primary Structure Section
                }
                if (Helix.IsHelix(line))
                {
                    return(Helix.FromString(line));                         // Secondary Structure Section
                }
                if (Sheet.IsSheet(line))
                {
                    return(Sheet.FromString(line));                         // Secondary Structure Section
                }
                if (Site.IsSite(line))
                {
                    return(Site.FromString(line));                          // Miscellaneous Features Section
                }
                if (Cryst1.IsCryst1(line))
                {
                    return(Cryst1.FromString(line));                        // Crystallographic and Coordinate Transformation Section
                }
                if (Anisou.IsAnisou(line))
                {
                    return(Anisou.FromString(line));                        // Coordinate Section
                }
                if (Atom.IsAtom(line))
                {
                    return(Atom.FromString(line));                          // Coordinate Section
                }
                if (Endmdl.IsEndmdl(line))
                {
                    return(Endmdl.FromString(line));                        // Coordinate Section
                }
                if (Hetatm.IsHetatm(line))
                {
                    return(Hetatm.FromString(line));                        // Coordinate Section
                }
                if (Model.IsModel(line))
                {
                    return(Model.FromString(line));                         // Coordinate Section
                }
                if (Siguij.IsSiguij(line))
                {
                    return(Siguij.FromString(line));                        // Coordinate Section
                }
                if (Ter.IsTer(line))
                {
                    return(Ter.FromString(line));                           // Coordinate Section
                }
                if (Conect.IsConect(line))
                {
                    return(Conect.FromString(line));                        // Connectivity Section
                }
                if (Master.IsMaster(line))
                {
                    return(Master.FromString(line));                        // Bookkeeping Section
                }
                if (End.IsEnd(line))
                {
                    return(End.FromString(line));                           // Bookkeeping Section
                }
                if (line.Substring(0, 6) == "DBREF ")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "SEQRES")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "MODRES")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "HET   ")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "HETNAM")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "FORMUL")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "SSBOND")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "LINK  ")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "ORIGX1")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "ORIGX2")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "ORIGX3")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "SCALE1")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "SCALE2")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "SCALE3")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "CISPEP")
                {
                    return(new Element(line));                                  // Connectivity Annotation Section
                }
                if (line.Substring(0, 6) == "HETSYN")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "SEQADV")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "SPRSDE")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "MTRIX1")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "MTRIX2")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "MTRIX3")
                {
                    return(new Element(line));
                }

                if (line.Substring(0, 6) == "MDLTYP")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "SPLIT ")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "CAVEAT")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "OBSLTE")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "HYDBND")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "SLTBRG")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "TVECT ")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "DBREF1")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "DBREF2")
                {
                    return(new Element(line));
                }
                if (line.Substring(0, 6) == "SIGATM")
                {
                    return(new Element(line));
                }

                HDebug.Assert(false);
                return(new Element(line));
            }
Ejemplo n.º 32
0
        /// <inheritdoc />
        public bool Equals([AllowNull] Z other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Show == other.Show ||
                     Show != null &&
                     Show.Equals(other.Show)
                     ) &&
                 (
                     Start == other.Start ||
                     Start != null &&
                     Start.Equals(other.Start)
                 ) &&
                 (
                     End == other.End ||
                     End != null &&
                     End.Equals(other.End)
                 ) &&
                 (
                     Size == other.Size ||
                     Size != null &&
                     Size.Equals(other.Size)
                 ) &&
                 (
                     Project == other.Project ||
                     Project != null &&
                     Project.Equals(other.Project)
                 ) &&
                 (
                     Color == other.Color ||
                     Color != null &&
                     Color.Equals(other.Color)
                 ) &&
                 (
                     UseColorMap == other.UseColorMap ||
                     UseColorMap != null &&
                     UseColorMap.Equals(other.UseColorMap)
                 ) &&
                 (
                     Width == other.Width ||
                     Width != null &&
                     Width.Equals(other.Width)
                 ) &&
                 (
                     Highlight == other.Highlight ||
                     Highlight != null &&
                     Highlight.Equals(other.Highlight)
                 ) &&
                 (
                     HighlightColor == other.HighlightColor ||
                     HighlightColor != null &&
                     HighlightColor.Equals(other.HighlightColor)
                 ) &&
                 (
                     HighlightWidth == other.HighlightWidth ||
                     HighlightWidth != null &&
                     HighlightWidth.Equals(other.HighlightWidth)
                 ));
        }
Ejemplo n.º 33
0
 public override string ToString()
 {
     return($"({Start.ToString()}; {End.ToString()})");
 }
Ejemplo n.º 34
0
 public override int GetHashCode() // we will need this one for caching
 {
     unchecked
     {
         return(((Start != null ? Start.GetHashCode() : 0) * 397) ^ (End != null ? End.GetHashCode() : 0));
     }
 }
Ejemplo n.º 35
0
 public override int GetHashCode()
 {
     return(Start.GetHashCode() * 397 * End.GetHashCode());
 }
Ejemplo n.º 36
0
 /// <summary>
 /// Returns true if the specified pointer is in a position between, or equal to this range's Start/End points.
 /// </summary>
 /// <param name="p"></param>
 /// <returns></returns>
 public bool InRange(MarkupPointer p)
 {
     return(Start.IsLeftOfOrEqualTo(p) && End.IsRightOfOrEqualTo(p));
 }
 public IActionResult Update(End end)
 {
     return(Ok(_endDAO.Update(end)));
 }
Ejemplo n.º 38
0
 public bool Intersects(MarkupRange range)
 {
     return(!(Start.IsRightOf(range.End) || End.IsLeftOf(range.Start)));
 }
Ejemplo n.º 39
0
 public override int GetHashCode()
 {
     return(1903003160 ^ Begin.GetHashCode() ^ End.GetHashCode());
 }
Ejemplo n.º 40
0
 /// <summary>
 /// Move this markup range to the specified location.
 /// </summary>
 /// <param name="textRange"></param>
 public void MoveToRange(MarkupRange range)
 {
     Start.MoveToPointer(range.Start);
     End.MoveToPointer(range.End);
 }
Ejemplo n.º 41
0
 private void toolStripMenuItem1_Click(object sender, EventArgs e)
 {
     if (myuser.bm == "CFO")
     {
         End.mydat = dataGridView1.CurrentRow;
         End jd = new End();
         jd.ShowDialog();
     }
     else
     {
         MessageBox.Show("你无权结单,NOT IS CFO");
     }
 }
Ejemplo n.º 42
0
    public void DeserializeDrives(List<NFLEPMarkov> EPList, int totalDrives, JObject drives) {
        List<Plays> PlaysCurrDrive = new List<Plays>();
        Start sDrive = new Start();
        End eDrive = new End();
        //Goes through each drive in gameID
        for (int i = 1; i <= totalDrives; ++i) {
            //Is the current drive aka 1,2,3,etc.
            using (var db = new NFLgame()) {
                var currentDrive = (JObject)drives[i.ToString()];

                if (currentDrive != null) {


                    //throw into using, IDisposable?
                    JsonSerializer serializer = new JsonSerializer();
                    //Store currentDrive into Drives object
                    Drives storeCurrentDrive = (Drives)serializer.Deserialize(new JTokenReader(currentDrive), typeof(Drives));

                    //taking the plays out of the currentDrive and storing into JObject
                    JObject playsInCurrentDrive = (JObject)currentDrive["plays"];
                    //taking the key of each individual play and storing into a list
                    IList<string> playsKeys = playsInCurrentDrive.Properties().Select(p => p.Name).ToList();

                    //going through each key of the ind. play and taking out the play, players and storing into objects
                    foreach (string key in playsKeys) {
                        //storing the play into play object, need the unique key for each play to read
                        Plays play = (Plays)serializer.Deserialize(new JTokenReader(playsInCurrentDrive[key]), typeof(Plays));
                        if (play == null) {
                            throw new NullReferenceException("Play is not supposed to be null");
                        }

                        if (play.Down != 0) { //Means Kickoff  edit around that will have to figure out what to do with those
                            int convertedYardsToTD = convertToIntYardtoTD(play.Yrdln, play.Posteam);
                            NFLEPMarkov tempMarkov = getExpectedPointsForPlay(EPList, play.Down, play.Ydstogo, convertedYardsToTD); //Down,YardsToGo,YardLine(in 1-99 format)
                            play.EPState = tempMarkov.State;
                            play.MarkovExpPts = tempMarkov.Markov;
                        }

                        JObject playersInCurrentPlay = (JObject)currentDrive["plays"][key]["players"];

                        //Getting the key (semi-unique, it's the playerID) and storing in a list
                        IList<string> playersKeys = playersInCurrentPlay.Properties().Select(p => p.Name).ToList();
                        //Going through each key and storing the players into players list
                        //Don't want to store player if playerkey is 0 and making sure that 
                        //the offense players are only being stored.  Play team poss is equal to the current drive team poss.
                        foreach (string playerKey in playersKeys) {
                            if (playerKey != "0" && play.Posteam == storeCurrentDrive.Posteam) {
                                //storing the playerID
                                string playerID = playerKey;
                                //Putting the current play players into a list
                                IList<Players> PlayersList = serializer.Deserialize<IList<Players>>(new JTokenReader(playersInCurrentPlay[playerKey]));
                            }
                        }
                        PlaysCurrDrive.Add(play);
                    }
                    //another way to do it, didnt work as well
                    //JEnumerable<JToken> playsContainer = results[gameID]["drives"][i.ToString()]["plays"].Children();

                    //Fill in ExpPt Data for start and end drive

                    //---> should handle start and end drive data in seperate function!  <----

                    sDrive = serializer.Deserialize<Start>(new JTokenReader(currentDrive["start"]));
                    eDrive = serializer.Deserialize<End>(new JTokenReader(currentDrive["end"]));    //?  Make this live ready, you don't know the end if it's live
                    StartEndDrive(PlaysCurrDrive, sDrive, eDrive);
                    //clear PlayA List
                    Plays startPlay = PlaysCurrDrive.First();
                    sDrive.expectedPts = startPlay.MarkovExpPts;
                    Plays endPlay = PlaysCurrDrive.Last();
                    eDrive.expectedPts = endPlay.MarkovExpPts;
                    if (startPlay == null || endPlay == null) { throw new NullReferenceException("StartPlay or EndPlay is null"); }
                    AnalyzeDrivePlaysList(PlaysCurrDrive, sDrive, eDrive);  //do start and end here
                }
            }
        }
    }