Example #1
1
 public Move()
 {
     _face = 0;
     _dir = 0;
 }
Example #2
0
        public static FACE ToFace(this FaceId fid)
        {
            if (fid.Sheet == 0)
            {
                return(FACE.None);
            }

            return((FACE)(((fid.Sheet - 1) * 16) + fid.Index));
        }
Example #3
0
 public CommandMessage(
     IAudioEngine s,
     EventManager m,
     string text1,
     string text2,
     string text3,
     FaceId face,
     SaveData save)
     : this(s, m, text1, text2, text3, face.Sheet, face.Index, face.Mono, save)
 {
 }
Example #4
0
 protected void AddCap(FaceId faceId)
 {
     Faces.Add(new Face
     {
         Index  = 0,
         Count  = Points.Count,
         ScaleU = 1f,
         Cap    = true,
         FaceId = faceId
     });
 }
Example #5
0
 public NumberSet(
     IAudioEngine s,
     EventManager m,
     string text1,
     FaceId face,
     bool mo,
     int valNumber,
     int numberDigit,
     SaveData save)
     : this(s, m, text1, face.Sheet, face.Index, mo, valNumber, numberDigit, save)
 {
 }
Example #6
0
 protected void AddFace(int i, int count, float scaleU, FaceId faceId, bool isFlat)
 {
     Faces.Add(new Face
     {
         Index  = i,
         Count  = count,
         ScaleU = scaleU,
         Flat   = isFlat,
         Cap    = false,
         FaceId = faceId
     });
 }
Example #7
0
 public Question(
     IAudioEngine s,
     EventManager m,
     string q1,
     string q2,
     string q3,
     bool fast,
     bool pfase,
     FaceId face,
     SaveData save)
     : this(s, m, q1, q2, q3, fast, pfase, face.Sheet, face.Index, save)
 {
 }
Example #8
0
    IEnumerator UploadAndDetect(Texture2D tex)
    {
        WWWForm form = new WWWForm();
        string  url  = "https://api.projectoxford.ai/face/v1.0/detect";

        byte[] bytes = tex.EncodeToPNG();
        Dictionary <string, string> headers = form.headers;

        headers["Ocp-Apim-Subscription-Key"] = "d1c36bdc6d7f4eb292369a9b9ec5caaf";
        headers["Content-Type"] = "application/octet-stream";
        headers["Accept"]       = "application/json";


        WWW w = new WWW(url, bytes, headers);

        yield return(w);

        if (!string.IsNullOrEmpty(w.error))
        {
            Debug.Log(w.error);
        }
        else
        {
            // if returned "[]", no faces were detected;
            if (w.text == "[]")
            {
                // do nothing
            }
            else
            {
                // parse face info
                try
                {
                    FaceId f = new FaceId();
                    string t = w.text.TrimStart('[').TrimEnd(']');
                    f            = JsonUtility.FromJson <FaceId>(t);
                    faceDetected = true;
                    Debug.Log("FaceDetected");
                    if (OnFaceDetected != null)
                    {
                        OnFaceDetected();
                    }
                }
                catch (System.Exception e)
                {
                    Debug.LogError(e.Message);
                }
            }
        }
    }
Example #9
0
 public Question(
     IAudioEngine s,
     EventManager m,
     string text1,
     string q1,
     string q2,
     bool fast,
     bool h,
     bool pfase,
     FaceId face,
     SaveData save,
     bool cancel)
     : this(s, m, text1, q1, q2, fast, h, pfase, face.Sheet, face.Index, save, cancel)
 {
 }
 public JsonResult FaceIdentification(string data)
 {
     try
     {
         FaceId fi = new FaceId();
         fi.FaceIdentification(data);
         if (fi.Error == "")
         {
             return(Json(new { Result = fi.Result, Error = "" }));
         }
         return(Json(new { Result = "", Error = fi.Error }));
     }
     catch (Exception e)// handling runtime errors and returning error as Json
     {
         return(Json(new { Result = "", Error = e.Message }));
     }
 }
Example #11
0
        protected override void SetStringValue(string value)
        {
            var entries = value.Split(':');

            if (!this.Validate(entries, $"Malformed shop event \"{value}\".", e => e.Length >= 7 && e[0] == "shop"))
            {
                return;
            }

            var newShopStockIndex = this.ParseIntOrAddError(entries[1]);

            var newShopTypeNumber = this.ParseIntOrAddError(entries[2]);

            this.ParseEnumOrAddError <ShopTypeNumber>(entries[2]);

            var newClerkType = this.ParseIntOrAddError(entries[3]);

            this.ParseEnumOrAddError <ShopClerkTypeNumber>(entries[3]);

            var newFaceSheet = this.ParseIntOrAddError(entries[4]);
            var newFaceIndex = this.ParseIntOrAddError(entries[5]);
            var newFace      = new FaceId(newFaceSheet, (byte)newFaceIndex, false).ToFace();

            this.ParseEnumOrAddError <FACE>(((int)newFace).ToString());

            var newPriceTypeNumber = this.ParseIntOrAddError(entries[6]);

            this.ParseEnumOrAddError <ShopPriceTypeNumber>(entries[6]);

            var newShopItems = new ShopItemCollection {
                StringValue = string.Join(":", entries.Skip(7)), ShopType = newShopTypeNumber, PriceType = newPriceTypeNumber
            };

            this.ShopStockIndex      = newShopStockIndex;
            this.ShopTypeNumber      = newShopTypeNumber;
            this.ShopClerkTypeNumber = newClerkType;
            this.Face            = newFace;
            this.PriceTypeNumber = newPriceTypeNumber;
            this.ShopItems       = newShopItems;
        }
Example #12
0
    protected bool Generate()
    {
        //Added 10.03.05 Dave Parks
        // Split is a parameter to LLProfile::generate that tesselates edges on the profile
        // to prevent lighting and texture interpolation errors on triangles that are
        // stretched due to twisting or scaling on the path.
        int split = (int)(Lod * 0.66f);

        if (Parameters.PathParameters.PathType == PathType.Line &&
            (Parameters.PathParameters.Scale.x != 1.0f || Parameters.PathParameters.Scale.y != 1.0f) &&
            (Parameters.ProfileParameters.ProfileType == ProfileType.Square ||
             Parameters.ProfileParameters.ProfileType == ProfileType.IsoTri ||
             Parameters.ProfileParameters.ProfileType == ProfileType.EqualTri ||
             Parameters.ProfileParameters.ProfileType == ProfileType.RightTri))
        {
            split = 0;
        }

        LodScaleBias = new Vector3(0.5f, 0.5f, 0.5f);

        float profile_detail = Lod;
        float path_detail    = Lod;

        if (Parameters.SculptType != SculptType.Mesh)
        {
            PathType    path_type    = Parameters.PathParameters.PathType;
            ProfileType profile_type = Parameters.ProfileParameters.ProfileType;
            if (path_type == PathType.Line && profile_type == ProfileType.Circle)
            {
                //cylinders don't care about Z-Axis
                LodScaleBias = new Vector3(0.6f, 0.6f, 0.0f);
            }
            else if (path_type == PathType.Circle)
            {
                LodScaleBias = new Vector3(0.6f, 0.6f, 0.6f);
            }
        }

        bool pathChanged    = Path.Generate(Parameters.PathParameters, path_detail, split);
        bool profileChanged = Profile.Generate(Parameters.ProfileParameters, Path.IsOpen, profile_detail, split);

        if (pathChanged || profileChanged)
        {
            Points.Clear();

            //Generate vertex positions:

            // Apply rotation, scaling and position:
            for (int s = 0; s < Path.PointCount; s++)
            {
                //Compute matrix for this step on the path:
                //NOTE: The order of applying the matrices is different from original Indra code.
                Matrix4x4 matrix = Path.Points[s].Rotation;
                Vector2   scale  = Path.Points[s].Scale;
                matrix *= new Matrix4x4(new Vector4(scale.x, 0f, 0f, 0f),
                                        new Vector4(0f, scale.y, 0f, 0f),
                                        new Vector4(0f, 0f, 0f, 0f),
                                        new Vector4(0f, 0f, 0f, 1f));
                Vector3 offset = Path.Points[s].Position;
                for (int t = 0; t < Profile.PointCount; t++)
                {
                    Points.Add(offset + matrix.MultiplyPoint3x4(Profile.Points[t]));
                }
            }

            foreach (Profile.Face face in Profile.Faces)
            {
                FaceMask |= face.FaceId;
            }

            return(true);
        }

        return(false);
    }
Example #13
0
 public override string ToString()
 {
     return("<Face FaceId=\"" + FaceId.ToString() + "\" FFData=\"" + Utils.Util.ToHex(FFData) + "\" />");
 }
Example #14
0
 public Move(FaceId f, TurnDir d)
 {
     _face = f;
     _dir = d;
 }