Exemple #1
0
        private void btn_CheckQuery_Click(object sender, EventArgs e)
        {
            CheckQuery cq = new CheckQuery(this);

            cq.MdiParent = this;
            SetMdiForm(cq.Text, typeof(CheckQuery));
        }
Exemple #2
0
    public static bool IsUnitVisibleFrom(Unit unit, Vector2 point, int obstacleMask, bool straightLine = false)
    {
        if (unit == null)
        {
            return(false);
        }
        var gridPoint = Vector2Int.FloorToInt(point / equalityGridCellSize);
        var query     = new CheckQuery {
            unit = unit, equalityGridPoint = gridPoint, straightLine = straightLine
        };

        CheckResult checkResult;

        if (!checkFacts.TryGetValue(query, out checkResult) || checkResult.hasExpired)
        {
            checkResult = new CheckResult {
                visible   = query.unit.IsVisibleFromPoint(point, obstacleMask, straightLine),
                timeStamp = Time.time
            };
            checkFacts[query] = checkResult;
        }

        if (++calls >= callsToCollectGarbage)
        {
            calls = 0;
            CollectGarbage();
        }

        return(checkResult.visible);
    }
        /// <summary>
        /// Validates a user's info, without logging into the account.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="dict"></param>
        public static void CheckProfileid(GPSPClient client, Dictionary <string, string> dict)
        {
            // \check\\nick\<nick>\email\<email>\partnerid\0\passenc\<passenc>\gamename\gmtest\final\
            //\cur\pid\<pid>\final
            //check is request recieved correct and convert password into our MD5 type
            bool isContiansAllKey = dict.ContainsKey("nick") && dict.ContainsKey("email") && (dict.ContainsKey("passenc") || dict.ContainsKey("pass"));

            if (!isContiansAllKey)
            {
                GameSpyUtils.SendGPError(client, GPErrorCode.Parse, "Parsing error, please check input.");
                return;
            }
            bool isEmailCorrect = GameSpyUtils.IsEmailFormatCorrect(dict["email"]);

            if (!isEmailCorrect)
            {
                GameSpyUtils.SendGPError(client, GPErrorCode.Parse, "Email format not correct.");
                return;
            }


            //Search pid in our database and return whether exist
            string sendingBuffer;
            int    profileid = CheckQuery.GetProfileidFromNickEmailPassword(dict);

            if (profileid != -1)
            {
                sendingBuffer = string.Format(@"\cur\0\pid\{0}\final\", profileid);
                client.Stream.SendAsync(sendingBuffer);
            }
            else
            {
                sendingBuffer = "No math found";
                GameSpyUtils.SendGPError(client, GPErrorCode.DatabaseError, sendingBuffer);
            }
        }