Пример #1
0
    /// <summary>
    /// Draws a flow between given origin and the siblings, which are currently selected.
    /// </summary>
    /// <param name="origin_map">Origin of the flows</param>
    /// <returns></returns>
    ///
    public virtual void GetInternalFlows(MapContainer origin_map)
    {
        Dictionary <String, InteractableMap> lchild = new Dictionary <string, InteractableMap>();

        foreach (var ma2p in origin_map.GetComponentsInChildren <InteractableMap>())
        {
            lchild[ma2p.name] = ma2p;
        }

        foreach (var pair in this.getMapController().flattenedList[origin_map.parentName].Take(100))
        {
            try
            {
                var origin      = lchild[pair.Item1];
                var destination = lchild[pair.Item2];
                var flowData    = pair.Item3;

                Bezier b = new Bezier(origin_map.transform, origin, destination, 0.1F * (0.00000699192F * flowData + 0.05F));
                origin_map.internalLines.Add(b);
            }
            catch { }

            //b.line.startWidth = 0.1F * (0.00000699192F * flowData + 0.05F);
            //Debug.Log("line width = " + b.line.startWidth.ToString());
            //b.line.endWidth = b.line.startWidth;

            //b.line.material = new Material(Shader.Find("Sprites/Default"));

            //b.line.startColor = Color.green; //new Color(253, 187, 45, 255);
            //b.line.endColor = Color.blue; // new Color(34, 193,195, 255);
        }
    }
Пример #2
0
    public void link_two_maps(MapContainer item)
    {
        //return;

        string ordered_state1;
        string ordered_state2;

        if (string.Compare(this.parentName, item.parentName) < 0)
        {
            ordered_state1 = this.parentName;
            ordered_state2 = item.parentName;
        }
        else
        {
            ordered_state1 = item.parentName;
            ordered_state2 = this.parentName;
        }

        var flows = this.mapController.county_flattened[new Tuple <string, string>(ordered_state1, ordered_state2)];

        Dictionary <String, InteractableMap> lchild1 = new Dictionary <string, InteractableMap>();

        foreach (var ma2p in this.GetComponentsInChildren <InteractableMap>())
        {
            lchild1[ma2p.name] = ma2p;
        }

        Dictionary <String, InteractableMap> lchild2 = new Dictionary <string, InteractableMap>();

        foreach (var ma2p in item.GetComponentsInChildren <InteractableMap>())
        {
            lchild2[ma2p.name] = ma2p;
        }

        foreach (var val in flows.Take(100))
        {
            InteractableMap origin;
            InteractableMap destination;
            Transform       origin_t;
            Transform       dest_t;


            if (val.Item1 == this.parentName)
            {
                origin      = lchild1[val.Item2];
                destination = lchild2[val.Item4];
                origin_t    = this.transform;
                dest_t      = item.transform;
            }
            else
            {
                origin      = lchild2[val.Item2];
                destination = lchild1[val.Item4];
                origin_t    = item.transform;
                dest_t      = this.transform;
            }
            var flowData = val.Item5;

            Bezier b = new Bezier(origin_t, origin, destination, 0.1F * (0.00000199192F * flowData + 0.05F), dest_t);

            this.internalLines.Add(b);
            item.internalLines.Add(b);
        }
    }