Example #1
0
 public RelayCommand(System.Action<object> execute, System.Predicate<object> canExecute)
 {
     if (execute == null)
     {
         throw new System.ArgumentNullException("execute");
     }
     this._execute = execute;
     this._canExecute = canExecute;
 }
Example #2
0
    public System.Predicate <int> System_Predicate_int(LuaFunction func, LuaTable self, bool flag)
    {
        if (func == null)
        {
            System.Predicate <int> fn = delegate(int param0) { return(false); };
            return(fn);
        }

        if (!flag)
        {
            System_Predicate_int_Event target = new System_Predicate_int_Event(func);
            System.Predicate <int>     d      = target.Call;
            target.method = d.Method;
            return(d);
        }
        else
        {
            System_Predicate_int_Event target = new System_Predicate_int_Event(func, self);
            System.Predicate <int>     d      = target.CallWithSelf;
            target.method = d.Method;
            return(d);
        }
    }
Example #3
0
    public static Delegate System_Predicate_string(LuaFunction func, LuaTable self, bool flag)
    {
        if (func == null)
        {
            System.Predicate <string> fn = delegate(string param0) { return(false); };
            return(fn);
        }

        if (!flag)
        {
            System_Predicate_string_Event target = new System_Predicate_string_Event(func);
            System.Predicate <string>     d      = target.Call;
            target.method = d.Method;
            return(d);
        }
        else
        {
            System_Predicate_string_Event target = new System_Predicate_string_Event(func, self);
            System.Predicate <string>     d      = target.CallWithSelf;
            target.method = d.Method;
            return(d);
        }
    }
Example #4
0
        private void button2_Click(object sender, EventArgs e)
        {
            ///خروجی این دلیگیت فقط بولین می باشد
            System.Predicate <string> PredicateDlegate1 = (s) => true;

            System.Predicate <string> PredicateDlegate2 = (s) =>
            {
                MessageBox.Show(s);
                if (s == "input")
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            };


            if (PredicateDlegate2("input"))
            {
                MessageBox.Show("is true");
            }
        }
        static StackObject *Find_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Predicate <global::UITool_Attribute> @match = (System.Predicate <global::UITool_Attribute>) typeof(System.Predicate <global::UITool_Attribute>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Collections.Generic.List <global::UITool_Attribute> instance_of_this_method = (System.Collections.Generic.List <global::UITool_Attribute>) typeof(System.Collections.Generic.List <global::UITool_Attribute>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.Find(@match);

            object obj_result_of_this_method = result_of_this_method;

            if (obj_result_of_this_method is CrossBindingAdaptorType)
            {
                return(ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance));
            }
            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
        /// <summary>
        /// Parses one or more CSV format curve files for all available dates.
        /// <para>
        /// A predicate is specified that is used to filter the dates that are returned.
        /// This could match a single date, a set of dates or all dates.
        /// </para>
        /// <para>
        /// If the files contain a duplicate entry an exception will be thrown.
        ///
        /// </para>
        /// </summary>
        /// <param name="datePredicate">  the predicate used to select the dates </param>
        /// <param name="groupsCharSource">  the curve groups CSV character source </param>
        /// <param name="settingsCharSource">  the curve settings CSV character source </param>
        /// <param name="curveValueCharSources">  the CSV character sources for curves </param>
        /// <returns> the loaded curves, mapped by date and identifier </returns>
        /// <exception cref="IllegalArgumentException"> if the files contain a duplicate entry </exception>
        public static ImmutableListMultimap <LocalDate, LegalEntityCurveGroup> parse(System.Predicate <LocalDate> datePredicate, CharSource groupsCharSource, CharSource settingsCharSource, ICollection <CharSource> curveValueCharSources)
        {
            IDictionary <CurveGroupName, IDictionary <Pair <RepoGroup, Currency>, CurveName> >        repoGroups        = new LinkedHashMap <CurveGroupName, IDictionary <Pair <RepoGroup, Currency>, CurveName> >();
            IDictionary <CurveGroupName, IDictionary <Pair <LegalEntityGroup, Currency>, CurveName> > legalEntityGroups = new LinkedHashMap <CurveGroupName, IDictionary <Pair <LegalEntityGroup, Currency>, CurveName> >();

            parseCurveMaps(groupsCharSource, repoGroups, legalEntityGroups);
            IDictionary <LocalDate, IDictionary <CurveName, Curve> > allCurves = parseCurves(datePredicate, settingsCharSource, curveValueCharSources);

            ImmutableListMultimap.Builder <LocalDate, LegalEntityCurveGroup> builder = ImmutableListMultimap.builder();

            foreach (KeyValuePair <LocalDate, IDictionary <CurveName, Curve> > curveEntry in allCurves.SetOfKeyValuePairs())
            {
                LocalDate date = curveEntry.Key;
                IDictionary <CurveName, Curve> curves = curveEntry.Value;
                foreach (KeyValuePair <CurveGroupName, IDictionary <Pair <RepoGroup, Currency>, CurveName> > repoEntry in repoGroups.SetOfKeyValuePairs())
                {
                    CurveGroupName groupName = repoEntry.Key;
                    IDictionary <Pair <RepoGroup, Currency>, Curve>        repoCurves   = MapStream.of(repoEntry.Value).mapValues(name => queryCurve(name, curves, date, groupName, "Repo")).toMap();
                    IDictionary <Pair <LegalEntityGroup, Currency>, Curve> issuerCurves = MapStream.of(legalEntityGroups[groupName]).mapValues(name => queryCurve(name, curves, date, groupName, "Issuer")).toMap();
                    builder.put(date, LegalEntityCurveGroup.of(groupName, repoCurves, issuerCurves));
                }
            }
            return(builder.build());
        }
Example #7
0
 public System.Collections.Generic.List <T> FindAll(System.Predicate <T> matcher)
 {
     System.Collections.Generic.List <T> items = base.Items as System.Collections.Generic.List <T>;
     return(items.FindAll(matcher));
 }
Example #8
0
 private bool IsNearChangedWhen_(System.Predicate <Timing> pred)
 {
     return(isNearChanged_ && pred(near_));
 }
Example #9
0
 void Push_System_Predicate_int(IntPtr L, System.Predicate <int> o)
 {
     ToLua.Push(L, o);
 }
Example #10
0
        /// <summary>
        /// Scans the schema store and loads all <seealso cref="SchemaRule rules"/> in it. This method is written with the assumption
        /// that there's no id reuse on schema records.
        /// </summary>
        /// <param name="predicate"> filter when loading. </param>
        /// <param name="returnType"> type of <seealso cref="SchemaRule"/> to load. </param>
        /// <param name="ignoreMalformed"> whether or not to ignore inconsistent records (used in consistency checking). </param>
        /// <returns> <seealso cref="System.Collections.IEnumerator"/> of the loaded schema rules, lazily loaded when advancing the iterator. </returns>
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: <ReturnType extends org.neo4j.storageengine.api.schema.SchemaRule> java.util.Iterator<ReturnType> loadAllSchemaRules(final System.Predicate<ReturnType> predicate, final Class<ReturnType> returnType, final boolean ignoreMalformed)
        internal virtual IEnumerator <ReturnType> LoadAllSchemaRules <ReturnType>(System.Predicate <ReturnType> predicate, Type returnType, bool ignoreMalformed) where ReturnType : Org.Neo4j.Storageengine.Api.schema.SchemaRule
        {
            returnType = typeof(ReturnType);
            return(new PrefetchingIteratorAnonymousInnerClass(this, predicate, returnType, ignoreMalformed));
        }
Example #11
0
 /// <summary>
 /// Removes all tags that match the given criteria.
 /// </summary>
 /// <param name="predicate"></param>
 public abstract void RemoveAll(System.Predicate <Tag> predicate);
Example #12
0
 public readonly NetFabric.Hyperlinq.ValueEnumerableExtensions.WhereEnumerable <NetFabric.Hyperlinq.ReadOnlyCollectionExtensions.ValueEnumerableWrapper <TSource>, NetFabric.Hyperlinq.ReadOnlyCollectionExtensions.ValueEnumerableWrapper <TSource> .Enumerator, TSource> Where(System.Predicate <TSource> predicate)
 => NetFabric.Hyperlinq.ValueEnumerableExtensions.Where <NetFabric.Hyperlinq.ReadOnlyCollectionExtensions.ValueEnumerableWrapper <TSource>, NetFabric.Hyperlinq.ReadOnlyCollectionExtensions.ValueEnumerableWrapper <TSource> .Enumerator, TSource>(this, predicate);
 public RetryACoupleOfTimesHandler(System.Predicate <Exception> retriable) : this(retriable, 5, 1, TimeUnit.SECONDS)
 {
 }
Example #14
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public <FROM, TO, EX extends Exception> java.util.concurrent.Future<TO> executeAndAwait(org.neo4j.function.ThrowingFunction<FROM,TO,EX> function, FROM parameter, System.Predicate<Thread> threadCondition, long timeout, java.util.concurrent.TimeUnit unit) throws java.util.concurrent.ExecutionException
        public virtual Future <TO> ExecuteAndAwait <FROM, TO, EX>(ThrowingFunction <FROM, TO, EX> function, FROM parameter, System.Predicate <Thread> threadCondition, long timeout, TimeUnit unit) where EX : Exception
        {
            FailableConcurrentTransfer <Thread> transfer = new FailableConcurrentTransfer <Thread>();
            Future <TO> future = _executor.submit(Task(function, function.ToString(), parameter, transfer));

            try
            {
                Predicates.awaitEx(transfer, throwingPredicate(threadCondition), timeout, unit);
            }
            catch (Exception e)
            {
                throw new ExecutionException(e);
            }
            return(future);
        }
Example #15
0
 public WorldClient[] FindClients(System.Predicate <WorldClient> predicate)
 {
     return(base.ClientManager.FindAll <WorldClient>(predicate));
 }
Example #16
0
    /// <summary>
    /// This is the main fucntion that loads the map and the plan waypoints
    /// </summary>
    /// <param name="path"></param>
    void LoadMap(string path)
    {
        //We load the main path
        if (ownPath == null)
        {
            ownPath = Path.Instance;
        }
        //laod the metadata
        string json = System.IO.File.ReadAllText(path);

        MapMetadata metadata = JsonUtility.FromJson <MapMetadata>(json);

        UnityEngine.Debug.Log("Loading map");

        BinaryFormatter bFormatter = new BinaryFormatter();
        //if (!AskForMap())
        //    return;
        FileStream file;

        //If it is a pointcloud we load a pointcloud map, and if it isn't a collada
        if (metadata.Map_type == (byte)MapMetadata.MapType.PointCloud)
        {
            file = File.OpenRead(Application.persistentDataPath + "/PersistentData/Maps/" + MissionManager.guid + ".dpl.map");
        }
        else
        {
            file = File.OpenRead(Application.persistentDataPath + "/PersistentData/Maps/" + MissionManager.guid + ".dae.map");
        }
        //var xmlWriter = new XmlTextWriter(file, Encoding.UTF8);
        //xmlWriter.
        XmlDocument doc = new XmlDocument();
        string      aux;

        GameObject auxGameObject = new GameObject();

        UnityEngine.Debug.Log(MissionManager.invMatrix);
        //An empty box and a 3d model are the same
        if (metadata.Map_type == (byte)MapMetadata.MapType.EmptyBox)
        {
            using (StreamReader reader = new StreamReader(file))
            {
                aux = reader.ReadToEnd();
            }
            doc.LoadXml(aux);
            ColladaImporter importer = new ColladaImporter(ref auxGameObject);
            StartCoroutine(importer.getMesh(doc, cullBackShader));
        }
        else if (metadata.Map_type == (byte)MapMetadata.MapType.Model3D)
        {
            using (StreamReader reader = new StreamReader(file))
            {
                aux = reader.ReadToEnd();
            }
            doc.LoadXml(aux);
            ColladaImporter importer = new ColladaImporter(ref auxGameObject);
            StartCoroutine(importer.getMesh(doc, shader));
        }//But pointclouds are loaded different
        else
        {
            //MapLoader used in mapalignment uses this exact function and they are already explained there
            createBaseTriangle();
            byte[]     pclBytes = File.ReadAllBytes(Application.persistentDataPath + "/PersistentData/Maps/" + MissionManager.guid + ".dpl.map");
            GameObject daeModel = new GameObject();
            daeModel.name             = "DaeModel";
            daeModel.transform.parent = auxGameObject.transform;
            LoadPointCloud(pclBytes, ref daeModel);
            //SavedPointCloud pointCloud = JsonUtility.FromJson<SavedPointCloud>(aux);
            //
            //for (int i = 0; i < pointCloud.PointCloud.Count; i++)
            //{
            //
            //    GameObject gameObject = Instantiate(pcPrefab, auxGameObject.transform);
            //    gameObject.GetComponent<MeshFilter>().sharedMesh = new Mesh();
            //    gameObject.GetComponent<MeshFilter>().sharedMesh.name = "cmesh" + i.ToString();
            //    gameObject.GetComponent<MeshFilter>().mesh.vertices = pointCloud.PointCloud[i].vertex;
            //    int[] indices = new int[pointCloud.PointCloud[i].vertex.Length];
            //    Color[] colors = new Color[indices.Length];
            //    for (int j = 0; j < pointCloud.PointCloud[i].vertex.Length; j++)
            //    {
            //        indices[j] = j;
            //        colors[j] = new Color(pointCloud.PointCloud[i].colors[j].x, pointCloud.PointCloud[i].colors[j].y, pointCloud.PointCloud[i].colors[j].z, 1);
            //    }
            //    gameObject.GetComponent<MeshFilter>().mesh.colors = colors;
            //    gameObject.GetComponent<MeshFilter>().mesh.RecalculateNormals();
            //    gameObject.GetComponent<MeshFilter>().mesh.SetIndices(indices, MeshTopology.Triangles, 0, true);
            //    gameObject.GetComponent<MeshFilter>().mesh.RecalculateBounds();
            //    Matrix4x4 auxMat = pointCloud.PointCloud[i].matrix;
            //    gameObject.transform.rotation = auxMat.rotation;
            //    gameObject.transform.position = new Vector3(auxMat.m03, auxMat.m13, auxMat.m23);
            //
            //
            //}
        }
        //Once the maps are loaded, we start with the waypoints. First a mission is loaded
        auxGameObject.name = "DaemodelChild";


        string mapJson      = File.ReadAllText(Application.persistentDataPath + "/PersistentData/Missions/" + MissionManager.guid + ".json.mission");
        Map    map          = JsonUtility.FromJson <Map>(mapJson);
        Path   waypointPath = Path.Instance;

        //sphereParentGO.transform.position = auxGameObject.transform.position;
        //If this isn't a new plan, we load the plan selected previously
        if (MissionManager.planIndex != -1)
        {
            //Here we get a plan from all the paths saved in missionmanager
            waypointPath = map.Paths[MissionManager.planIndex];
            ownPath.setPath(waypointPath);
            //And give them the default parameters previously selected
            MissionManager.planDefaultHeight   = waypointPath.FlightParams.height;
            MissionManager.planDefaultSpeed    = waypointPath.FlightParams.speed;
            MissionManager.planDefaultDuration = waypointPath.FlightParams.duration;

            //Here we instantiate the waypoints
            for (int i = 0; i < waypointPath.Count(); i++)
            {
                //waypointPath.GetPoint(i).PointPosition = new Vector3(waypointPath.GetPoint(i).PointPosition.x, waypointPath.GetPoint(i).PointPosition.z, waypointPath.GetPoint(i).PointPosition.y);

                GameObject auxPoint = Instantiate(pointGO, waypointPath.GetPoint(i).PointPosition, Quaternion.Euler(0, 0, 0), sphereParentGO.transform);
                //assign them the transform to the script
                waypointPath.GetPoint(i).PointTransf = auxPoint.transform;
                auxPoint.SetActive(true);
                //Scale it
                TransformSphere(topCam, auxPoint);
                //And if it is the first one, we assign it the yellow colour, and to the last one, the green colour. The rest use the normal waypoint colour
                if (i == 0)
                {
                    auxPoint.transform.GetChild(0).GetComponent <Renderer>().sharedMaterial = homeNotSelectedMaterial;
                    //auxPoint.transform.GetChild(1).GetComponent<Renderer>().sharedMaterial.color = Color.white;
                }
                else if (i != waypointPath.Count() - 1)
                {
                    auxPoint.transform.GetChild(0).GetComponent <Renderer>().sharedMaterial = waypointNotSelectedMaterial;
                    // auxPoint.transform.GetChild(1).GetComponent<Renderer>().sharedMaterial.color = Color.white;
                    //auxPoint.transform.GetChild(0).GetComponent<Renderer>().sharedMaterial = whiteOutlineMaterial;
                    //auxPoint.transform.GetChild(1).GetComponent<Renderer>().sharedMaterial = whiteOutlineMaterial;
                }
                else
                {
                    //auxPoint.transform.GetChild(0).GetComponent<Renderer>().sharedMaterial = landingMaterial;
                    //auxPoint.transform.GetChild(1).GetComponent<Renderer>().sharedMaterial = landingMaterial;
                    auxPoint.transform.GetChild(0).GetComponent <Renderer>().sharedMaterial = landingNotSelectedMaterial;
                    //auxPoint.transform.GetChild(1).GetComponent<Renderer>().sharedMaterial.color = Color.white;
                }
                //We assign the monobehaviour that contains the point parameters
                auxPoint.AddComponent <PathPoint>().createPathPointWithPoint(waypointPath.GetPoint(i), 0, 0);
            }

            //here we create the middlepoints that the curve contains
            for (int i = 0; i < waypointPath.Count() - 1; i++)
            {
                lineMat.SetPass(0);
                if (topCam != null)
                {
                    CatmullRomSpline.DisplayCatmullRomSpline2(waypointPath, i, ref waypointPath.middlePointsTop, topCam.orthographicSize / 2.0f, true, topCam);
                }
                if (frontCam != null)
                {
                    CatmullRomSpline.DisplayCatmullRomSpline(waypointPath, i, ref waypointPath.middlePointsRight, frontCam.orthographicSize / 2.0f, true, frontCam);
                }
            }
            //This script is also used on recording, where we don't want points of interests. We adjust the path to the adjustmnets doen in model alignment and exit
            if (GeneralSceneManager.sceneState == GeneralSceneManager.SceneState.Recording)
            {
                sphereParentGO.transform.position   = new Vector3(map.unityToAnchors.m03 * 0.001f, map.unityToAnchors.m23 * 0.001f, map.unityToAnchors.m13 * 0.001f);
                sphereParentGO.transform.localScale = new Vector3(map.unityToAnchors.m00 * 0.001f, map.unityToAnchors.m11 * 0.001f, map.unityToAnchors.m22 * 0.001f);
                return;
            }


            //If not we create the points of interest
            poisCreated = new List <GameObject>();

            for (int i = 0; i < waypointPath.wpParametersCount(); i++)
            {
                //for each waypoint of interest that the path contains, we assign it to the respective waypoint
                GimballParameters auxGimballUpdateParameters = waypointPath.getGbUpdateParameter(i);
                Point             auxPoint = waypointPath.GetPoint(auxGimballUpdateParameters.id_pointer);
                auxPoint.PointTransf.gameObject.GetComponent <PathPoint>().Wp.gimbal_parameters = auxGimballUpdateParameters;
                //And now depending on the type of point of interest, one behaviour is assigned. It can be a look at point, look at the curve,
                //locked in yaw only while looking in a direction or looking in a direction without locks
                switch (auxGimballUpdateParameters.mode)
                {
                case 0:
                    GameObject newpoi;
                    //First we search for a POI
                    System.Predicate <GameObject> predicate = (GameObject p) => { return(p.transform.position == auxGimballUpdateParameters.poi_or_angles); };
                    //If one POI has been placed at least
                    if (poisCreated.Count > 0)
                    {
                        //we find if the POI was already there, just in case multiple waypoints share the same POI
                        newpoi = poisCreated.Find(predicate);
                        if (newpoi == null)
                        {
                            newpoi = Instantiate(poi, auxGimballUpdateParameters.poi_or_angles, Quaternion.Euler(new Vector3(0, 0, 0)));
                            poisCreated.Add(newpoi);
                            newpoi.AddComponent <POI>();
                        }
                    }
                    else
                    {
                        newpoi = Instantiate(poi, auxGimballUpdateParameters.poi_or_angles, Quaternion.Euler(new Vector3(0, 0, 0)));
                        poisCreated.Add(newpoi);
                        newpoi.AddComponent <POI>();
                    }



                    //We create a new line that points from the POI to the waypoint. The poi object already has one, but if there is more than one waypoint
                    //related to the POI, we need to create more lines
                    GameObject newLine = newpoi.transform.GetChild(2).gameObject;

                    if (i > 0)
                    {
                        newLine = Instantiate(poi.transform.GetChild(2).gameObject, newpoi.transform.position, Quaternion.Euler(new Vector3(0, 0, 0)), newpoi.transform);
                    }
                    //All of this calculate the rotation, position and size of the line
                    Vector3 centerPos = new Vector3(auxPoint.PointTransf.position.x + newpoi.transform.position.x, auxPoint.PointTransf.position.y + newpoi.transform.position.y, auxPoint.PointTransf.position.z + newpoi.transform.position.z) / 2f;
                    float   scaleX    = Mathf.Abs((auxPoint.PointTransf.position - newpoi.transform.position).magnitude);

                    newLine.transform.localScale = new Vector3(scaleX, 3f, 3f);
                    //Esto es para rotar las imagenes de las camaras que tienen cada Waypoint
                    Transform cube = auxPoint.PointTransf.Find("CubeTop");
                    cube.gameObject.SetActive(true);

                    //float distance = Vector3.Distance(item.transform.position, newpoi.transform.position);
                    //float distance2 = Vector3.Distance(cube.position, item.transform.position) * 2;
                    Vector2   from  = new Vector2(-1, 0);
                    Vector3   aux2  = newpoi.transform.position - auxPoint.PointTransf.position;
                    Vector2   to    = new Vector2(aux2.x, aux2.z).normalized;
                    float     angle = Vector2.SignedAngle(from, to);
                    Transform cube2 = auxPoint.PointTransf.Find("CubeFront");
                    //float distance = Vector3.Distance(item.transform.position, newpoi.transform.position);
                    //float distance2 = Vector3.Distance(cube.position, item.transform.position) * 2;
                    Vector2 from2  = new Vector2(-1, 0);
                    Vector3 aux3   = newpoi.transform.position - auxPoint.PointTransf.position;
                    Vector2 to2    = new Vector2(aux3.x, aux3.y).normalized;
                    float   angle2 = Vector2.SignedAngle(from2, to2);

                    //float angle = Mathf.Acos(distance2 / distance);
                    //item.transform.Rotate(new Vector3(0, 1, 0), Vector2.Angle(from, to));
                    cube.transform.rotation  = Quaternion.Euler(new Vector3(0, -angle, 0));
                    cube2.transform.rotation = Quaternion.Euler(new Vector3(0, 0, angle2));
                    cube.GetChild(0).GetComponent <MeshRenderer>().material.color  = Color.white;
                    cube2.GetChild(0).GetComponent <MeshRenderer>().material.color = Color.white;
                    auxPoint.PointTransf.GetComponent <PathPoint>().Poi            = newpoi.transform;
                    newpoi.GetComponent <POI>().addPoint(auxPoint.PointTransf.GetComponent <PathPoint>(), newLine);
                    //UnityEngine.Debug.Log(newpoi.GetComponent<POI>().Referenced.Count);

                    float sineC = (auxPoint.PointTransf.position.y - newpoi.transform.position.y) / scaleX;

                    newLine.transform.rotation = Quaternion.Euler(0, -angle, Mathf.Asin(sineC) * Mathf.Rad2Deg);
                    newLine.transform.position = newpoi.transform.position;
                    var rotation = Quaternion.Euler(0, -angle, Mathf.Asin(sineC) * Mathf.Rad2Deg).eulerAngles;
                    auxPoint.PointTransf.GetComponent <PathPoint>().GimbalRotation = new Vector3(rotation.z, rotation.y, rotation.x + 90);
                    auxPoint.PointTransf.GetComponent <PathPoint>().getGimballMode = 0;
                    TransformSphere(topCam, newpoi);

                    break;

                case 1:
                    //This is the case where the direction will always point to the curve
                    float angle3 = 0;
                    float angle4 = 0;

                    int middlePointsIndexTop   = 0;
                    int middlePointsIndexRight = 0;
                    //We iterate through the array to see the closest point from the curve to the waypoint. The signal that indicates this mode is activated is a green camera looking at that point on the waypoint.
                    for (i = 0; i < waypointPath.Count(); i++)
                    {
                        if (waypointPath.GetPoint(i) == auxPoint)
                        {
                            break;
                        }
                        middlePointsIndexTop   += waypointPath.GetPoint(i).SegmentsTop;
                        middlePointsIndexRight += waypointPath.GetPoint(i).SegmentsRight;
                    }
                    //If this is the last point, there is no curve to look at anymore
                    if (middlePointsIndexRight >= waypointPath.middlePointsRight.Count)
                    {
                        break;
                    }
                    //Now from here we calculate the rotation of the camera mentioned above
                    Vector3 pointRight = waypointPath.middlePointsRight[middlePointsIndexRight];
                    Vector3 pointTop   = waypointPath.middlePointsTop[middlePointsIndexTop];


                    //Esto es para rotar las imagenes de las camaras que tienen cada Waypoint
                    Transform cube3 = auxPoint.PointTransf.Find("CubeTop");
                    cube3.gameObject.SetActive(true);
                    //float distance = Vector3.Distance(item.transform.position, newpoi.transform.position);
                    //float distance2 = Vector3.Distance(cube.position, item.transform.position) * 2;
                    Vector2 from3 = new Vector2(-1, 0);
                    Vector3 aux4  = pointTop - auxPoint.PointTransf.position;
                    Vector2 to3   = new Vector2(aux4.x, aux4.z).normalized;

                    angle3 = Vector2.SignedAngle(from3, to3);

                    Transform cube4 = auxPoint.PointTransf.Find("CubeFront");
                    cube4.gameObject.SetActive(true);

                    cube3.GetChild(0).GetComponent <MeshRenderer>().material.color = Color.green;
                    cube4.GetChild(0).GetComponent <MeshRenderer>().material.color = Color.green;

                    //float distance = Vector3.Distance(item.transform.position, newpoi.transform.position);
                    //float distance2 = Vector3.Distance(cube.position, item.transform.position) * 2;
                    Vector2 from4 = new Vector2(-1, 0);
                    Vector3 aux5  = pointRight - auxPoint.PointTransf.position;
                    Vector2 to4   = new Vector2(aux5.x, aux5.y).normalized;
                    angle4 = Vector2.SignedAngle(from4, to4);

                    //float angle = Mathf.Acos(distance2 / distance);
                    //item.transform.Rotate(new Vector3(0, 1, 0), Vector2.Angle(from, to));
                    cube3.transform.rotation = Quaternion.Euler(new Vector3(0, -angle3, 0));
                    cube4.transform.rotation = Quaternion.Euler(new Vector3(0, 0, angle4));
                    //UnityEngine.Debug.Log(newpoi.GetComponent<POI>().Referenced.Count);
                    break;

                case 2:

                    //This mode is for a direction with the yaw? locked
                    //We only show a line in this mode, so even if we instantiate a poi, is not shown
                    GameObject newpoi2 = Instantiate(poi, auxGimballUpdateParameters.poi_or_angles + auxPoint.PointTransf.position, Quaternion.Euler(new Vector3(0, 0, 0)));
                    //UnityEngine.Debug.Log(" POI POS: " + auxGimballUpdateParameters.poi_or_angles + " ITEM POS: " + auxPoint.PointTransf.position);


                    /*
                     * if (Input.mousePosition.x < Camera.main.pixelWidth / 2)
                     * {
                     *  newpoi.transform.position = new Vector3(newpoi.transform.position.x, 0, newpoi.transform.position.z);
                     *
                     * }
                     * else
                     * {
                     *  newpoi.transform.position = new Vector3(newpoi.transform.position.x, newpoi.transform.position.y, 1);
                     *
                     * }*/
                    newpoi2.SetActive(true);
                    newpoi2.transform.GetChild(0).gameObject.SetActive(false);
                    newpoi2.transform.GetChild(1).gameObject.SetActive(false);
                    newpoi2.AddComponent <POI>();
                    newpoi2.GetComponent <POI>().Direction = true;


                    float angle5 = 0;
                    float angle6 = 0;
                    float sineC5 = 0;



                    //from now on, we isntantiate a line and calculate position and direction
                    GameObject newLine2 = newpoi2.transform.GetChild(2).gameObject;
                    if (i > 0)
                    {
                        newLine2 = Instantiate(poi.transform.GetChild(2).gameObject, newpoi2.transform.position, Quaternion.Euler(new Vector3(0, 0, 90)), newpoi2.transform);
                    }
                    newLine2.transform.GetChild(0).GetComponent <Renderer>().material.color = Color.grey;
                    newLine2.transform.GetChild(0).gameObject.layer = 10;
                    //Que tamaño tendra
                    float scaleX5 = Mathf.Abs((auxPoint.PointTransf.position - newpoi2.transform.position).magnitude);

                    newLine2.transform.localScale = new Vector3(scaleX5, 3f, 3f);
                    //Esto es para rotar las imagenes de las camaras que tienen cada Waypoint
                    Transform cube5 = auxPoint.PointTransf.Find("CubeTop");
                    cube5.gameObject.SetActive(false);
                    //float distance = Vector3.Distance(item.transform.position, newpoi.transform.position);
                    //float distance2 = Vector3.Distance(cube.position, item.transform.position) * 2;
                    Vector2 from5 = new Vector2(-1, 0);
                    Vector3 aux6  = newpoi2.transform.position - auxPoint.PointTransf.position;
                    Vector2 to5   = new Vector2(aux6.x, aux6.z).normalized;
                    if (i == 0)
                    {
                        angle5 = Vector2.SignedAngle(from5, to5);
                    }
                    Transform cube6 = auxPoint.PointTransf.Find("CubeFront");
                    //float distance = Vector3.Distance(item.transform.position, newpoi.transform.position);
                    //float distance2 = Vector3.Distance(cube.position, item.transform.position) * 2;
                    Vector2 from6 = new Vector2(-1, 0);
                    Vector3 aux7  = newpoi2.transform.position - auxPoint.PointTransf.position;
                    Vector2 to6   = new Vector2(aux7.x, aux7.y).normalized;
                    if (i == 0)
                    {
                        angle6 = Vector2.SignedAngle(from6, to6);
                    }

                    //float angle = Mathf.Acos(distance2 / distance);
                    //item.transform.Rotate(new Vector3(0, 1, 0), Vector2.Angle(from, to));
                    cube5.transform.rotation = Quaternion.Euler(new Vector3(0, -angle5, 0));
                    cube6.transform.rotation = Quaternion.Euler(new Vector3(0, 0, angle6));
                    cube5.GetChild(0).GetComponent <MeshRenderer>().material.color = Color.white;
                    cube6.GetChild(0).GetComponent <MeshRenderer>().material.color = Color.white;
                    auxPoint.PointTransf.GetComponent <PathPoint>().Poi            = newpoi2.transform;
                    newpoi2.GetComponent <POI>().addPoint(auxPoint.PointTransf.GetComponent <PathPoint>(), newLine2);
                    //UnityEngine.Debug.Log(newpoi.GetComponent<POI>().Referenced.Count);

                    sineC5 = (auxPoint.PointTransf.transform.position.y - newpoi2.transform.position.y) / scaleX5;

                    newLine2.transform.rotation = Quaternion.Euler(0, -angle5, Mathf.Asin(sineC5) * Mathf.Rad2Deg);

                    newLine2.transform.position = auxPoint.PointTransf.transform.position;
                    var rotation2 = Quaternion.Euler(0, -angle5, Mathf.Asin(sineC5) * Mathf.Rad2Deg).eulerAngles;



                    break;

                case 3:

                    //Same as above without locking yaw
                    GameObject newpoi3 = Instantiate(poi, auxGimballUpdateParameters.poi_or_angles + auxPoint.PointTransf.position, Quaternion.Euler(new Vector3(0, 0, 0)));


                    newpoi3.transform.GetChild(0).gameObject.SetActive(false);
                    newpoi3.transform.GetChild(1).gameObject.SetActive(false);
                    newpoi3.AddComponent <POI>();
                    newpoi3.GetComponent <POI>().Direction = true;

                    float angle7 = 0;
                    float angle8 = 0;
                    float sineC7 = 0;

                    //Creamos una nueva linea que apunta del waypoint al POI
                    GameObject newLine3 = newpoi3.transform.GetChild(2).gameObject;

                    //newLine3 = Instantiate(poi.transform.GetChild(2).gameObject, newpoi3.transform.position, Quaternion.Euler(new Vector3(0, 0, 0)), newpoi3.transform);


                    newLine3.transform.GetChild(0).GetComponent <Renderer>().material.color = Color.gray;
                    //Que tamaño tendra
                    float scaleX7 = Mathf.Abs((auxPoint.PointTransf.position - newpoi3.transform.position).magnitude);

                    newLine3.transform.localScale = new Vector3(scaleX7, 3f, 3f);
                    //Esto es para rotar las imagenes de las camaras que tienen cada Waypoint
                    Transform cube7 = auxPoint.PointTransf.Find("CubeTop");
                    cube7.gameObject.SetActive(true);

                    //float distance = Vector3.Distance(item.transform.position, newpoi.transform.position);
                    //float distance2 = Vector3.Distance(cube.position, item.transform.position) * 2;
                    Vector2 from7 = new Vector2(-1, 0);
                    Vector3 aux8  = newpoi3.transform.position - auxPoint.PointTransf.position;
                    Vector2 to7   = new Vector2(aux8.x, aux8.z).normalized;
                    if (i == 0)
                    {
                        angle7 = Vector2.SignedAngle(from7, to7);
                    }
                    Transform cube8 = auxPoint.PointTransf.Find("CubeFront");
                    //float distance = Vector3.Distance(item.transform.position, newpoi.transform.position);
                    //float distance2 = Vector3.Distance(cube.position, item.transform.position) * 2;
                    Vector2 from8 = new Vector2(-1, 0);
                    Vector3 aux9  = newpoi3.transform.position - auxPoint.PointTransf.position;
                    Vector2 to8   = new Vector2(aux8.x, aux8.y).normalized;
                    if (i == 0)
                    {
                        angle2 = Vector2.SignedAngle(from8, to8);
                    }

                    //float angle = Mathf.Acos(distance2 / distance);
                    //item.transform.Rotate(new Vector3(0, 1, 0), Vector2.Angle(from, to));
                    cube7.transform.rotation = Quaternion.Euler(new Vector3(0, -angle7, 0));
                    cube8.transform.rotation = Quaternion.Euler(new Vector3(0, 0, angle8));
                    cube7.GetChild(0).GetComponent <MeshRenderer>().material.color = Color.white;
                    cube8.GetChild(0).GetComponent <MeshRenderer>().material.color = Color.white;
                    auxPoint.PointTransf.GetComponent <PathPoint>().Poi            = newpoi3.transform;
                    newpoi3.GetComponent <POI>().addPoint(auxPoint.PointTransf.GetComponent <PathPoint>(), newLine3);
                    //UnityEngine.Debug.Log(newpoi.GetComponent<POI>().Referenced.Count);
                    sineC7 = (auxPoint.PointTransf.position.y - newpoi3.transform.position.y) / scaleX7;

                    newLine3.transform.rotation = Quaternion.Euler(0, -angle7, Mathf.Asin(sineC7) * Mathf.Rad2Deg);
                    newLine3.transform.position = auxPoint.PointTransf.transform.position;



                    break;

                default:
                    break;
                }
            }

            //This assigns reccam parameters to the waypoints that had them
            for (int i = 0; i < waypointPath.rcParametersCount(); i++)
            {
                RecCamParameters auxRcUpdateParameters = waypointPath.getRcUpdateParameter(i);

                reSetRecCamGuis(auxRcUpdateParameters, waypointPath.GetPoint(auxRcUpdateParameters.id_pointer).PointTransf.gameObject.GetComponent <PathPoint>());
            }

            if (poiEditorPanel != null)
            {
                poiEditorPanel.GetComponent <POIEditor>().Deactivate();
            }

            //activate every panel. If we saved a path, there has to be enough points to make sure this can be done
            if (editPointButton != null)
            {
                editPointButton.interactable = true;
                editPOIButton.interactable   = true;
                previewButton.interactable   = true;
                CurveButton.interactable     = true;
            }
        }
        else  //We assign an index to the new path
        {
            if (waypointPath != null)
            {
                MissionManager.planIndex = map.Paths.Count;
            }
        }
        //importedGO.name = "DaeModel";
    }
 public static RetryHandler RetryACoupleOfTimesOn(System.Predicate <Exception> retriable)
 {
     return(new RetryACoupleOfTimesHandler(retriable));
 }
    static int FindLastIndex(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.Generic.List <string>), typeof(System.Predicate <string>)))
            {
                System.Collections.Generic.List <string> obj = (System.Collections.Generic.List <string>)ToLua.ToObject(L, 1);
                System.Predicate <string> arg0 = null;
                LuaTypes funcType2             = LuaDLL.lua_type(L, 2);

                if (funcType2 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (System.Predicate <string>)ToLua.ToObject(L, 2);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 2);
                    arg0 = DelegateFactory.CreateDelegate(typeof(System.Predicate <string>), func) as System.Predicate <string>;
                }

                int o = obj.FindLastIndex(arg0);
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.Generic.List <string>), typeof(int), typeof(System.Predicate <string>)))
            {
                System.Collections.Generic.List <string> obj = (System.Collections.Generic.List <string>)ToLua.ToObject(L, 1);
                int arg0 = (int)LuaDLL.lua_tonumber(L, 2);
                System.Predicate <string> arg1 = null;
                LuaTypes funcType3             = LuaDLL.lua_type(L, 3);

                if (funcType3 != LuaTypes.LUA_TFUNCTION)
                {
                    arg1 = (System.Predicate <string>)ToLua.ToObject(L, 3);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 3);
                    arg1 = DelegateFactory.CreateDelegate(typeof(System.Predicate <string>), func) as System.Predicate <string>;
                }

                int o = obj.FindLastIndex(arg0, arg1);
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.Generic.List <string>), typeof(int), typeof(int), typeof(System.Predicate <string>)))
            {
                System.Collections.Generic.List <string> obj = (System.Collections.Generic.List <string>)ToLua.ToObject(L, 1);
                int arg0 = (int)LuaDLL.lua_tonumber(L, 2);
                int arg1 = (int)LuaDLL.lua_tonumber(L, 3);
                System.Predicate <string> arg2 = null;
                LuaTypes funcType4             = LuaDLL.lua_type(L, 4);

                if (funcType4 != LuaTypes.LUA_TFUNCTION)
                {
                    arg2 = (System.Predicate <string>)ToLua.ToObject(L, 4);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 4);
                    arg2 = DelegateFactory.CreateDelegate(typeof(System.Predicate <string>), func) as System.Predicate <string>;
                }

                int o = obj.FindLastIndex(arg0, arg1, arg2);
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: System.Collections.Generic.List<string>.FindLastIndex"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
 public static RetryHandler RetryACoupleOfTimesOn(System.Predicate <Exception> retriable, int maxRetryCount, long timeBetweenTries, TimeUnit unit)
 {
     return(new RetryACoupleOfTimesHandler(retriable, maxRetryCount, timeBetweenTries, unit));
 }
 public virtual System.IDisposable Subscribe(System.IObserver <System.Collections.Generic.KeyValuePair <string, object> > observer, System.Predicate <string> isEnabled)
 {
     throw null;
 }
 public readonly bool Any(System.Predicate <TSource> predicate)
 => NetFabric.Hyperlinq.ValueReadOnlyCollectionExtensions.Any <NetFabric.Hyperlinq.LinkedListBindings.ValueWrapper <TSource>, System.Collections.Generic.LinkedList <TSource> .Enumerator, TSource>(this, predicate);
Example #22
0
 public PrefetchingIteratorAnonymousInnerClass(SchemaStorage outerInstance, System.Predicate <ReturnType> predicate, Type returnType, bool ignoreMalformed)
 {
     this.outerInstance    = outerInstance;
     this._predicate       = predicate;
     this._returnType      = returnType;
     this._ignoreMalformed = ignoreMalformed;
     highestId             = outerInstance.schemaStore.HighestPossibleIdInUse;
     currentId             = 1;
     scratchData           = outerInstance.newRecordBuffer();
     record = outerInstance.schemaStore.NewRecord();
 }
 public readonly NetFabric.Hyperlinq.ValueEnumerableExtensions.WhereEnumerable <NetFabric.Hyperlinq.LinkedListBindings.ValueWrapper <TSource>, System.Collections.Generic.LinkedList <TSource> .Enumerator, TSource> Where(System.Predicate <TSource> predicate)
 => NetFabric.Hyperlinq.ValueEnumerableExtensions.Where <NetFabric.Hyperlinq.LinkedListBindings.ValueWrapper <TSource>, System.Collections.Generic.LinkedList <TSource> .Enumerator, TSource>(this, predicate);
Example #24
0
        private static void ExtractObjectsImpl <V>(object data, object parent, string path, IDictionary <string, Property <V> > idToObjectMap, System.Predicate <object> predicate, System.Func <object, V> reviver) where V : Identifiable
        {
            if (data == null)
            {
                return;
            }
            // if the predicate is true, then this data should be extracted
            if (predicate(data))
            {
                // apply reviver if provided to generate new Data
                V newData = reviver != null?reviver(data) : (V)data;

                // add a new entry to the idToObject map
                idToObjectMap[newData.GetId()] = new Property <V>(newData.GetId(), newData, path, parent);
            }
            else if (data is JContainer)
            {
                if (data is JObject)
                { //loop over subelements
                    foreach (var element in ((JObject)data))
                    {
                        ExtractObjectsImpl <V>(element.Value, data, path.Length == 0 ? element.Key : path + "." + element.Key, idToObjectMap, predicate, reviver);
                    }
                }
                else if (data is JArray)
                { //loop over indexes .
                    int idx = 0;
                    foreach (var value in ((JArray)data))
                    {
                        ExtractObjectsImpl <V>(value, data, path + "[" + idx + "]", idToObjectMap, predicate, reviver);
                        idx++;
                    }
                }
            }
            else if (data.GetType().IsArray)
            {
                // if it is an array, iterate through each element  extract objects recursively
                int idx = 0;
                foreach (var value in (object[])data)
                {
                    ExtractObjectsImpl(value, data, path + "[" + idx + "]", idToObjectMap, predicate, reviver);
                    idx++;
                }
            }
            else if (data is System.Collections.IDictionary)
            {
                foreach (KeyValuePair <string, object> element in ((IDictionary <string, object>)data).SetOfKeyValuePairs())
                {
                    ExtractObjectsImpl(element.Value, data, path.Length == 0 ? element.Key : path + "." + element.Key, idToObjectMap, predicate, reviver);
                }
            }
            else if (typeof(System.Collections.ICollection).IsAssignableFrom(data.GetType()))
            {
                ICollection col = (ICollection)data;
                // if it is a collection, iterate through each element extract objects recursively
                int idx = 0;
                foreach (var value in col)
                {
                    ExtractObjectsImpl(value, data, path + "(" + idx + ")", idToObjectMap, predicate, reviver);
                    idx++;
                }
            }
            else
            {
                // if it is an object, iterate through each entry
                // and extract objects recursively
                Type clazz = data.GetType();

                //if (data is object && !data.GetType().FullName.StartsWith("System.", StringComparison.Ordinal))
                if (clazz.IsClass && !data.GetType().Namespace.StartsWith("System"))
                {
                    System.Reflection.FieldInfo[] fields = clazz.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);
                    foreach (FieldInfo field in fields)
                    {
                        if (field.FieldType.IsPrimitive || field.FieldType.IsValueType || field.FieldType.IsEnum || field.IsStatic)
                        {
                            continue;
                        }
                        object value = field.GetValue(data);

                        ExtractObjectsImpl(value, data, path.Length == 0 ? field.Name : path + "." + field.Name, idToObjectMap, predicate, reviver);
                    }
                }
            }
        }
Example #25
0
        /// <summary>
        /// 部屋と部屋をつなぐ道を作成する
        /// </summary>
        /// <returns></returns>
        private void CreateRoad(TileDataMap tileDataMap, MapRectData mapRect, int indexA, int indexB)
        {
            var dataA = mapRect[indexA];
            var dataB = mapRect[indexB];

            var rectA = dataA.rect;
            var rectB = dataB.rect;
            var roomA = dataA.room;
            var roomB = dataB.room;

            var roadData = new RoadData();

            System.Predicate <TileData> createRoadData =
                (tileData_) =>
            {
                roadData.Add(tileData_.Pos);
                return(true);
            };

            // 区画は上下左右のどちらでつながっているかで処理を分ける
            if (rectA.yMax == rectB.yMin || rectA.yMin == rectB.yMax)
            {
                var x1 = Utility.Random.MaxIncludedRange(roomA.xMin, roomA.xMax - 1);
                var x2 = Utility.Random.MaxIncludedRange(roomB.xMin, roomB.xMax - 1);

                int y;

                // Aのほうが左
                var isLeftA = x1 < x2;

                var left  = Mathf.Min(x1, x2);
                var right = Mathf.Max(x1, x2) + 1;

                if (rectA.yMin > rectB.yMin)
                {
                    // B
                    // A
                    y = rectA.yMin;

                    if (isLeftA)
                    {
                        // Bと横道を繋ぐ道を作る
                        tileDataMap.FillRectRoad(x2, roomB.yMax, x2 + 1, y, createRoadData);

                        tileDataMap.FillRectRoadReverse(left, y, right, y + 1, createRoadData);

                        // Aと横道を繋ぐ道を作る
                        tileDataMap.FillRectRoad(x1, y + 1, x1 + 1, roomA.yMin, createRoadData);
                    }
                    else
                    {
                        // Bと横道を繋ぐ道を作る
                        tileDataMap.FillRectRoad(x2, roomB.yMax, x2 + 1, y, createRoadData);

                        tileDataMap.FillRectRoad(left, y, right, y + 1, createRoadData);

                        // Aと横道を繋ぐ道を作る
                        tileDataMap.FillRectRoad(x1, y + 1, x1 + 1, roomA.yMin, createRoadData);
                    }
                }
                else
                {
                    // A
                    // B
                    y = rectB.yMin;

                    if (isLeftA)
                    {
                        tileDataMap.FillRectRoad(x1, roomA.yMax, x1 + 1, y, createRoadData);
                        tileDataMap.FillRectRoad(left, y, right, y + 1, createRoadData);
                        tileDataMap.FillRectRoad(x2, y + 1, x2 + 1, roomB.yMin, createRoadData);
                    }
                    else
                    {
                        tileDataMap.FillRectRoad(x1, roomA.yMax, x1 + 1, y, createRoadData);
                        tileDataMap.FillRectRoadReverse(left, y, right, y + 1, createRoadData);
                        tileDataMap.FillRectRoad(x2, y + 1, x2 + 1, roomB.yMin, createRoadData);
                    }
                }

                // AとB両方に道のデータをもたせる
                dataA.roads.Add(roadData);

                return;
            }

            if (rectA.xMax == rectB.xMin || rectA.xMin == rectB.xMax)
            {
                var y1 = Utility.Random.MaxIncludedRange(roomA.yMin, roomA.yMax - 1);
                var y2 = Utility.Random.MaxIncludedRange(roomB.yMin, roomB.yMax - 1);

                int x;

                // Aのほうが上
                var isTopA = y1 < y2;

                var top    = Mathf.Min(y1, y2);
                var bottom = Mathf.Max(y1, y2) + 1;


                if (rectA.xMin > rectB.xMin)
                {
                    // BA
                    x = rectA.xMin;

                    if (isTopA)
                    {
                        tileDataMap.FillRectRoad(roomB.xMax, y2, x, y2 + 1, createRoadData);
                        tileDataMap.FillRectRoadReverse(x, top, x + 1, bottom, createRoadData);
                        tileDataMap.FillRectRoad(x + 1, y1, roomA.xMin, y1 + 1, createRoadData);
                    }
                    else
                    {
                        tileDataMap.FillRectRoad(roomB.xMax, y2, x, y2 + 1, createRoadData);
                        tileDataMap.FillRectRoad(x, top, x + 1, bottom, createRoadData);
                        tileDataMap.FillRectRoad(x + 1, y1, roomA.xMin, y1 + 1, createRoadData);
                    }
                }
                else
                {
                    // AB
                    x = rectB.xMin;

                    if (isTopA)
                    {
                        tileDataMap.FillRectRoad(roomA.xMax, y1, x, y1 + 1, createRoadData);
                        tileDataMap.FillRectRoad(x, top, x + 1, bottom, createRoadData);
                        tileDataMap.FillRectRoad(x + 1, y2, roomB.xMin, y2 + 1, createRoadData);
                    }
                    else
                    {
                        tileDataMap.FillRectRoad(roomA.xMax, y1, x, y1 + 1, createRoadData);
                        tileDataMap.FillRectRoadReverse(x, top, x + 1, bottom, createRoadData);
                        tileDataMap.FillRectRoad(x + 1, y2, roomB.xMin, y2 + 1, createRoadData);
                    }
                }

                // AとB両方に道のデータをもたせる
                dataA.roads.Add(roadData);

                return;
            }
        }
Example #26
0
 public static bool IsNearChangedWhen(System.Predicate <Timing> pred)
 {
     return(Current_.IsNearChangedWhen_(pred));
 }
Example #27
0
 public AudioMateClip Find(System.Predicate <AudioMateClip> predicate) => _clips.Find(predicate);
Example #28
0
 private bool IsJustChangedWhen_(System.Predicate <Timing> pred)
 {
     return(isJustChanged_ && pred(just_));
 }
Example #29
0
 public readonly bool Any(System.Predicate <TSource> predicate)
 => NetFabric.Hyperlinq.ValueEnumerableExtensions.Any <NetFabric.Hyperlinq.ValueEnumerable.CreateValueEnumerable <TEnumerator, TSource>, TEnumerator, TSource>(this, predicate);
Example #30
0
 public int RemoveAll(System.Predicate <T> match)
 {
     System.Collections.Generic.List <T> items = base.Items as System.Collections.Generic.List <T>;
     return(items.RemoveAll(match));
 }
 public readonly bool Any(System.Predicate <TResult> predicate)
 => NetFabric.Hyperlinq.ValueEnumerableExtensions.Any <NetFabric.Hyperlinq.ArrayExtensions.ArraySegmentSelectManyEnumerable <TSource, TSubEnumerable, TSubEnumerator, TResult>, NetFabric.Hyperlinq.ArrayExtensions.ArraySegmentSelectManyEnumerable <TSource, TSubEnumerable, TSubEnumerator, TResult> .Enumerator, TResult>(this, predicate);