Esempio n. 1
0
    //=================================

    /*
     * m.atlas[atlas.name] = atlas.name;
     *  m.data = {};
     *  m.data.name = spData.name;
     *  m.data.path = spData.path;
     *
     *  m.data.x = spData.x;
     *  m.data.y = spData.y;
     *  m.data.width = spData.width;
     *  m.data.height = spData.height;
     *
     *  m.data.borderLeft = spData.borderLeft
     *  m.data.borderRight = spData.borderRight
     *  m.data.borderTop = spData.borderTop
     *  m.data.borderBottom = spData.borderBottom
     *
     *  m.data.paddingLeft = spData.paddingLeft
     *  m.data.paddingRight = spData.paddingRight
     *  m.data.paddingTop = spData.paddingTop
     *  m.data.paddingBottom = spData.paddingBottom
     * end
     * m.times = m.times or 0;
     * m.times = m.times + 1;
     *
     */

    void initData()
    {
        isShowParckerView = false;
        isSelectedAll     = false;
        currSelectSprite  = null;
        packTex           = null;
        packRects         = null;
        packSprites.Clear();
        mSpriteList.Clear();
        if (string.IsNullOrEmpty(mSpritesBorrowInforFile))
        {
            return;
        }
        string    content   = File.ReadAllText(mSpritesBorrowInforFile);
        Hashtable spriteMap = JSON.DecodeMap(content);
        Hashtable m         = null;
        Hashtable data      = null;

        mSpriteList = MapEx.vals2List(spriteMap);
        mSpriteList.Sort(new MySortSpriteBorrow());
//		for (int i = 0; i < mSpriteList.Count; i++) {
//			m = mSpriteList [i] as Hashtable;
//			data = MapEx.getMap (m, "data");
//			Debug.Log (MapEx.getString (data, "name") + "," + MapEx.getInt (m, "times"));
//		}
    }
    public static void saveMaterialTexCfg(string matName, ArrayList propNames, ArrayList texNames, ArrayList texPaths)
    {
        if (propNames == null || propNames.Count <= 0)
        {
            Debug.Log("There is no textures");
            return;
        }
        if (!needSave(matName, propNames, texNames, texPaths))
        {
            return;
        }
        Hashtable map = MapEx.getMap(CLMaterialPool.materialTexRefCfg, matName);

        if (map == null)
        {
            map = new Hashtable();
        }
        map ["pp"] = propNames;
        map ["tn"] = texNames;
        map ["tp"] = texPaths;
        CLMaterialPool.materialTexRefCfg [matName] = map;

        MemoryStream ms = new MemoryStream();

        B2OutputStream.writeObject(ms, CLMaterialPool.materialTexRefCfg);
        Directory.CreateDirectory(Path.GetDirectoryName(CLMaterialPool.materialTexRefCfgPath));
        //File.WriteAllBytes (CLMaterialPool.materialTexRefCfgPath, ms.ToArray ());
        byte[]     bytes = ms.ToArray();
        FileStream fs    = new FileStream(CLMaterialPool.materialTexRefCfgPath, FileMode.OpenOrCreate);

        fs.Write(bytes, 0, bytes.Length);
        fs.Close();
    }
Esempio n. 3
0
    static public Hashtable create2Map(string path)
    {
        basePath = Application.dataPath + "/";
        basePath = basePath.Replace("/Assets/", "/");
        replaces.Clear();
        replaces.Add(basePath + "Assets/StreamingAssets/");
        replaces.Add(basePath + "Assets/Resources/");
        replaces.Add(basePath + "Assets/");

        path = basePath + path;

        string    lastVerPath = Application.dataPath + "/" + ECLProjectManager.ver4DevelopeMd5;
        Hashtable lastVerMap  = Utl.fileToMap(lastVerPath);

        if (lastVerMap == null)
        {
            lastVerMap = new Hashtable();
        }

        Hashtable lastOtherVer    = MapEx.getMap(lastVerMap, "other");
        Hashtable lastPriorityVer = MapEx.getMap(lastVerMap, "priority");
        Hashtable lastCfgdataVer  = MapEx.getMap(lastVerMap, "cfgData");

        Hashtable outMap = new Hashtable();

        doCreate(path, lastOtherVer, lastPriorityVer, lastCfgdataVer, ref outMap);
        return(outMap);
    }
Esempio n. 4
0
    public void updateState(string name)
    {
        if (selectedServer == null)
        {
            return;
        }
        if (mList == null)
        {
            return;
        }
        Hashtable item = null;

        for (int i = 0; i < mList.Count; i++)
        {
            item = ListEx.getMap(mList, i);
            if (name.Equals(MapEx.getString(item, "name")))
            {
//				item ["upload"] = true;
                Hashtable m = MapEx.getMap(item, "upload");
                m = m == null ? new Hashtable() : m;
                m [selectedServer.key] = true;
                item ["upload"]        = m;
                break;
            }
        }

        string str = JSON.JsonEncode(mList);

        File.WriteAllText(Application.dataPath + "/" + cfgPath, str);
    }
    public static bool needSave(string matName, ArrayList propNames, ArrayList texNames, ArrayList texPaths)
    {
        if (propNames == null || propNames.Count <= 0)
        {
            Debug.Log("There is no textures");
            return(false);
        }
        //Debug.Log("matName===" + matName);
        Hashtable map = MapEx.getMap(CLMaterialPool.materialTexRefCfg, matName);

        if (map == null)
        {
            return(true);
        }
        ArrayList _propNames = MapEx.getList(map, "pp");
        ArrayList _texNames  = MapEx.getList(map, "tn");
        ArrayList _texPaths  = MapEx.getList(map, "tp");

        if (!arrayList2Str(_propNames).Equals(arrayList2Str(propNames)) ||
            !arrayList2Str(_texNames).Equals(arrayList2Str(texNames)) ||
            !arrayList2Str(_texPaths).Equals(arrayList2Str(texPaths)))
        {
            return(true);
        }
        return(false);
    }
Esempio n. 6
0
    int CompareSprite2(Hashtable a, Hashtable b)
    {
        // A is null b is not b is greater so put it at the front of the list
        if (a == null && b != null)
        {
            return(1);
        }

        // A is not null b is null a is greater so put it at the front of the list
        if (a != null && b == null)
        {
            return(-1);
        }

        Hashtable d1 = MapEx.getMap(a, "data");
        Hashtable d2 = MapEx.getMap(b, "data");
        // Get the total pixels used for each sprite
        int w       = MapEx.getInt(d1, "width");
        int h       = MapEx.getInt(d1, "height");
        int aPixels = w > h ? w : h;

        w = MapEx.getInt(d2, "width");
        h = MapEx.getInt(d2, "height");
        int bPixels = w > h ? w : h;

        if (aPixels > bPixels)
        {
            return(-1);
        }
        else if (aPixels < bPixels)
        {
            return(1);
        }
        return(0);
    }
Esempio n. 7
0
        public override void Deserialize(Hashtable map)
        {
                        #if UNITY_EDITOR
            base.Deserialize(map);
            begainIndex = MapEx.getInt(map, "begainIndex");
            maxIndex    = MapEx.getInt(map, "maxIndex");

            string actionClass = MapEx.getString(map, "actionClass");
            if (string.IsNullOrEmpty(actionClass))
            {
                monoScript = null;
            }
            else
            {
                monoScript = AssetDatabase.LoadAssetAtPath(actionClass, typeof(MonoScript)) as MonoScript;
                if (monoScript != null)
                {
                    Type tp = monoScript.GetClass();
                    attr = Activator.CreateInstance(tp) as ActionBase;
                    if (attr != null)
                    {
                        attr.Deserialize(MapEx.getMap(map, "attr"));
                    }
                }
            }
                        #endif
        }
Esempio n. 8
0
 public override void Deserialize(Hashtable map)
 {
     triggerType = MapEx.getInt(map, "triggerType");
     hideSelf    = MapEx.getBool(map, "hideSelf");
     talkId      = MapEx.getInt(map, "talkId");
     npcCfg      = MapEx.getString(map, "npcCfg");
     boxCfg      = MapEx.getString(map, "boxCfg");
 }
 /// <summary>
 /// Centers the map on the required point.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="center">The point to center map on.</param>
 private void CenterMap(MapEx sender, Position center)
 {
     // Move the map center to the required position
     if (this.Control != null)
     {
         var nativeMap = (MKMapView)this.Control;
         nativeMap.SetCenterCoordinate(new CLLocationCoordinate2D(center.Latitude, center.Longitude), true);
     }
 }
        /// <summary>
        /// Checks whether the location service is available.
        /// </summary>
        /// <param name="sender">The rendered <see cref="MapEx"/> element.</param>
        /// <param name="completionSource">The completion source for the asynchronous operation.</param>
        private static void CheckLocationService(MapEx sender, TaskCompletionSource <bool> completionSource)
        {
            // Get the location service
            var locationService = new Geolocator();

            completionSource.TrySetResult(
                (locationService.LocationStatus != PositionStatus.NotAvailable) &&
                (locationService.LocationStatus != PositionStatus.Disabled));
        }
Esempio n. 11
0
    public bool isUploaded(Hashtable item)
    {
        if (selectedServer == null)
        {
            return(false);
        }
        Hashtable m = MapEx.getMap(item, "upload");

        return(MapEx.getBool(m, selectedServer.key));
    }
Esempio n. 12
0
        public static WorldmapEditorCfg parse(Hashtable map)
        {
            WorldmapEditorCfg cfg = new WorldmapEditorCfg();

            cfg.size               = MapEx.getInt(map, "size");
            cfg.pageSize           = MapEx.getInt(map, "pageSize");
            cfg.mapAreaTexturePath = MapEx.getString(map, "mapAreaTexturePath");
            cfg.colors4MapAreaJson = MapEx.getString(map, "colors4MapAreaJson");
            return(cfg);
        }
Esempio n. 13
0
        public virtual void Deserialize(Hashtable map)
        {
            float x = float.Parse(map ["editorx"].ToString());
            float y = float.Parse(map ["editory"].ToString());

            editorPosition = new Vector2(x, y);
            id             = MapEx.getInt(map, "id");
            desc           = MapEx.getString(map, "desc");
            index          = MapEx.getInt(map, "index");
            canMultTimes   = MapEx.getBool(map, "canMultTimes");
        }
 /// <summary>
 /// Centers the map on the required point.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="center">The point to center map on.</param>
 private async void CenterMap(MapEx sender, Position center)
 {
     // Move the map center to the required position
     if (this.Control != null)
     {
         var geopoint =
             new Geopoint(new BasicGeoposition {
             Latitude = center.Latitude, Longitude = center.Longitude
         });
         await this.Control.TrySetViewAsync(geopoint);
     }
 }
 /// <summary>
 /// Centers the map on the required point.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="center">The point to center map on.</param>
 private void CenterMap(MapEx sender, Position center)
 {
     // Move the map center to the required position
     if ((this.Control != null) && (this.map != null))
     {
         var cameraPosition = new CameraPosition.Builder()
                              .Target(new LatLng(center.Latitude, center.Longitude))
                              .Zoom(this.map.CameraPosition.Zoom)
                              .Tilt(this.map.CameraPosition.Tilt)
                              .Bearing(this.map.CameraPosition.Bearing)
                              .Build();
         this.map.AnimateCamera(CameraUpdateFactory.NewCameraPosition(cameraPosition));
     }
 }
    public void onGetUpgradePkgMultMode(params object[] paras)
    {
        Hashtable d        = paras [0] as Hashtable;
        string    platform = paras [1] as string;
        string    oldMd5   = "";

        //
        if (EditorUtility.DisplayDialog("Alert", "Really want to upgrade all selected servers!!", "Okay", "Cancel"))
        {
            foreach (DictionaryEntry cell in servers)
            {
                Hashtable server = cell.Value as Hashtable;
                if (MapEx.getBool(server, "selected"))
                {
                    string verKey  = "";
                    string vetType = "1";
                    if (platform.Equals("ios"))
                    {
                        verKey  = "iosversion";
                        vetType = "1";
                    }
                    else if (platform.Equals("Android"))
                    {
                        verKey  = "androidversion";
                        vetType = "2";
                    }
                    else if (platform.Equals("win"))
                    {
                        verKey  = "winversion";
                        vetType = "3";
                    }
                    else if (platform.Equals("osx"))
                    {
                        verKey  = "osxversion";
                        vetType = "4";
                    }
                    oldMd5 = MapEx.getString(server, verKey);
                    string newMd5 = MapEx.getString(d, "md5");
                    if (!newMd5.Equals(oldMd5))
                    {
                        server [verKey]      = newMd5;
                        server ["pkgName"]   = MapEx.getString(d, "name");
                        server ["pkgRemark"] = MapEx.getString(d, "remark");
                        saveData(MapEx.getString(server, "idx"), newMd5, vetType);
                    }
                }
            }
        }
    }
        /// <summary>
        /// Checks whether the location service is available.
        /// </summary>
        /// <param name="sender">The rendered <see cref="MapEx"/> element.</param>
        /// <param name="completionSource">The completion source for the asynchronous operation.</param>
        private static void CheckLocationService(MapEx sender, TaskCompletionSource <bool> completionSource)
        {
            // Get the location service
            var manager =
                Android.App.Application.Context.GetSystemService(Context.LocationService) as
                Android.Locations.LocationManager;

            if (manager == null)
            {
                completionSource.TrySetCanceled();
                return;
            }

            completionSource.TrySetResult(manager.IsProviderEnabled(Android.Locations.LocationManager.GpsProvider));
        }
Esempio n. 18
0
    int sortBorrowTimes(object a, object b)
    {
        Hashtable m1  = a as Hashtable;
        Hashtable m2  = b as Hashtable;
        int       ret = 0;

        if (MapEx.getInt(m1, "times") > MapEx.getInt(m2, "times"))
        {
            ret = 1;
        }
        else
        {
            ret = -1;
        }
        return(ret);
    }
    public void onGetUpgradePkg(params object[] paras)
    {
        string    oldMd5   = "";
        Hashtable d        = paras [0] as Hashtable;
        ArrayList orgsList = paras [1] as ArrayList;
        string    key      = orgsList [0] as string;
        string    platform = orgsList [1] as string;

        Hashtable server  = MapEx.getMap(servers, key);
        string    verKey  = "";
        string    vetType = "1";

        if (platform.Equals("ios"))
        {
            verKey  = "iosversion";
            vetType = "1";
        }
        else if (platform.Equals("Android"))
        {
            verKey  = "androidversion";
            vetType = "2";
        }
        else if (platform.Equals("win"))
        {
            verKey  = "winversion";
            vetType = "3";
        }
        else if (platform.Equals("osx"))
        {
            verKey  = "osxversion";
            vetType = "4";
        }
        oldMd5 = MapEx.getString(server, verKey);
        string newMd5 = MapEx.getString(d, "md5");

        if (!newMd5.Equals(oldMd5))
        {
            if (EditorUtility.DisplayDialog("Alert", "Really want to upgrade this server!!", "Okay", "Cancel"))
            {
                server [verKey]      = newMd5;
                server ["pkgName"]   = MapEx.getString(d, "name");
                server ["pkgRemark"] = MapEx.getString(d, "remark");
                servers [key]        = server;
                saveData(MapEx.getString(server, "idx"), newMd5, vetType);
            }
        }
    }
    public void refreshData()
    {
        servers = null;
        getUpgradePkgListData();
        if (selectedServer == null)
        {
            return;
        }
//		string __httpBaseUrl = PStr.b ().a ("http://").a (Net.self.gateHost).a (":").a (Net.self.gatePort).e ();
//		string url = PStr.b ().a (__httpBaseUrl).a ("/KokDirServer/ServerServlet").e ();
        string url = selectedServer.getServerListUrl;

        if (string.IsNullOrEmpty(url))
        {
            return;
        }
        Dictionary <string, object> paras = new Dictionary <string, object> ();

        paras ["serverType"] = 1;
        HttpWebResponse response = HttpEx.CreatePostHttpResponse(url, paras, 10000, System.Text.Encoding.UTF8);

        if (response == null)
        {
            return;
        }
        string str = HttpEx.readString(response);

        response.Close();
//		Debug.Log (url);
//		string str = HttpEx.readString (url, null);
        Debug.Log(str);
        servers = JSON.DecodeMap(str);
        Hashtable server = null;
        Hashtable pkg    = null;

        if (servers != null)
        {
            foreach (DictionaryEntry cell in servers)
            {
                server               = cell.Value as Hashtable;
                pkg                  = getUpgradePkgByMd5(MapEx.getString(server, "version"));
                server ["pkgName"]   = MapEx.getString(pkg, "name");
                server ["pkgRemark"] = MapEx.getString(pkg, "remark");
            }
        }
    }
Esempio n. 21
0
    void refreshSelectedCount()
    {
        int ret = 0;

        allSpriteCount = 0;
        selectedCount  = 0;
        for (int i = 0; i < mSpriteList.Count && i < (int)packerSize; i++)
        {
            allSpriteCount += 1;
            item            = mSpriteList [i] as Hashtable;
            if (MapEx.getBool(item, "selected"))
            {
                ret += 1;
            }
        }
        selectedCount = ret;
    }
    Hashtable getUpgradePkgByMd5(string md5)
    {
        if (upgradePkgList == null)
        {
            getUpgradePkgListData();
        }
        Hashtable cell = null;

        for (int i = 0; i < upgradePkgList.Count; i++)
        {
            cell = (Hashtable)(upgradePkgList [i]);
            if (MapEx.getString(cell, "md5") == md5)
            {
                return(cell);
            }
        }
        return(null);
    }
        /// <summary>
        /// Checks whether the location service is available.
        /// </summary>
        /// <param name="sender">The rendered <see cref="MapEx"/> element.</param>
        /// <param name="completionSource">The completion source for the asynchronous operation.</param>
        private static void CheckLocationService(MapEx sender, TaskCompletionSource <bool> completionSource)
        {
            // Get the authorization status
            var status = CLLocationManager.Status;

            if ((status == CLAuthorizationStatus.Authorized) || (status == CLAuthorizationStatus.AuthorizedAlways) ||
                (status == CLAuthorizationStatus.AuthorizedWhenInUse))
            {
                completionSource.TrySetResult(true);
            }
            else if ((status == CLAuthorizationStatus.Denied) || (status == CLAuthorizationStatus.Restricted))
            {
                completionSource.TrySetResult(false);
            }
            else
            {
                // If status is not determined
                lock (MapExRenderer.Locker)
                {
                    // Request location authorization
                    if (MapExRenderer.manager == null)
                    {
                        MapExRenderer.manager = new CLLocationManager();
                        MapExRenderer.manager.RequestWhenInUseAuthorization();
                    }
                }

                // When authorization status changed
                MapExRenderer.manager.AuthorizationChanged += (s, e) =>
                {
                    if ((e.Status == CLAuthorizationStatus.Authorized) ||
                        (e.Status == CLAuthorizationStatus.AuthorizedAlways) ||
                        (e.Status == CLAuthorizationStatus.AuthorizedWhenInUse))
                    {
                        completionSource.TrySetResult(true);
                    }
                    else if ((e.Status == CLAuthorizationStatus.Denied) ||
                             (e.Status == CLAuthorizationStatus.Restricted))
                    {
                        completionSource.TrySetResult(false);
                    }
                };
            }
        }
Esempio n. 24
0
        public virtual void DeserializeChildren(Hashtable map)
        {
            ArrayList list = MapEx.getList(map, "Children");
            Node      node = null;

            for (int i = 0; i < list.Count; i++)
            {
                int id = int.Parse(list [i].ToString());
                node = behaviorTree.getNodeByID(id);
                ConnectChild(node);
            }

            list = MapEx.getList(map, "KillNodes");
            node = null;
            for (int i = 0; i < list.Count; i++)
            {
                int id = int.Parse(list [i].ToString());
                node = behaviorTree.getNodeByID(id);
                ConnectKillChild(node);
            }
        }
Esempio n. 25
0
    public void refreshData()
    {
        if (mList == null)
        {
            return;
        }
        Hashtable item = null;

        for (int i = 0; i < mList.Count; i++)
        {
            item = ListEx.getMap(mList, i);
            if (Directory.Exists(getUpgradePackagePath(MapEx.getString(item, "name"))))
            {
                item ["exist"] = true;
            }
            else
            {
                item ["exist"] = false;
            }
        }
    }
    public void setUpgradePkgMutlMode(string platform)
    {
        bool canSetMd5 = false;

        foreach (DictionaryEntry cell in servers)
        {
            Hashtable server = cell.Value as Hashtable;
            if (MapEx.getBool(server, "selected"))
            {
                canSetMd5 = true;
                break;
            }
        }
        if (canSetMd5)
        {
            ECLUpgradeListProc.popup4Select((Callback)onGetUpgradePkgMultMode, platform);
        }
        else
        {
            Debug.LogError("Please select some servers!!");
        }
    }
Esempio n. 27
0
        // Calls CaseInsensitiveComparer.Compare with the parameters reversed.
        int IComparer.Compare(object a, object b)
        {
            Hashtable m1    = a as Hashtable;
            Hashtable m2    = b as Hashtable;
            int       ret   = 0;
            int       time1 = MapEx.getInt(m1, "times");
            int       time2 = MapEx.getInt(m2, "times");

            if (time1 < time2)
            {
                ret = 1;
            }
            else if (time1 == time2)
            {
                ret = 0;
            }
            else
            {
                ret = -1;
            }
            return(ret);
        }
Esempio n. 28
0
        public override void DeserializeChildren(Hashtable map)
        {
            ArrayList children = MapEx.getList(map, "ChildrenLeft");
            Node      node     = null;

            for (int i = 0; i < children.Count; i++)
            {
                int id = int.Parse(children [i].ToString());
                node = behaviorTree.getNodeByID(id);
                ConnectLeftChild(node);
            }

            children = MapEx.getList(map, "ChildrenRight");
            for (int i = 0; i < children.Count; i++)
            {
                int id = int.Parse(children [i].ToString());
                node = behaviorTree.getNodeByID(id);
                ConnectRightChild(node);
            }

            children = MapEx.getList(map, "KillLeftNodes");
            for (int i = 0; i < children.Count; i++)
            {
                int id = int.Parse(children [i].ToString());
                node = behaviorTree.getNodeByID(id);
                ConnectKillLeftChild(node);
            }

            children = MapEx.getList(map, "KillRightNodes");
            for (int i = 0; i < children.Count; i++)
            {
                int id = int.Parse(children [i].ToString());
                node = behaviorTree.getNodeByID(id);
                ConnectKillRightChild(node);
            }
        }
Esempio n. 29
0
        public void doGenerateNodeState(Node node, ref Hashtable map)
        {
            if (MapEx.getBool(map, node) || node == node.behaviorTree.rootNode)
            {
                return;
            }
            map [node] = true;

            int    mainType = 14;
            string pubStr   = "";

            if (node.behaviorTree.rootNode.attr != null)
            {
                pubStr = mainType + "/" + ((MyRoot)(node.behaviorTree.rootNode.attr)).fubenID + "/";
            }
            else
            {
                pubStr = mainType + "/" + 0 + "/";
            }

            //Condition
            if (node.parents != null && node.parents.Count > 0)
            {
                node.condition = "{";
                if ((node.parents.Count == 1 && (node.parents [0]) is Root))
                {
                    node.condition += "{\"" + pubStr + node.index + "/" + 0 + "\"}";
                }
                else if (node.parents.Contains(node.behaviorTree.rootNode))
                {
                    node.condition += "{\"" + pubStr + node.index + "/" + 0 + "\",\"" + pubStr + node.index + "/" + 1 + "\"}";
                }
                else
                {
                    node.condition += "{\"" + pubStr + node.index + "/" + 1 + "\"}";
                }

                if (node is NodeTogether)
                {
                    Node parent = null;
                    for (int i = 0; i < node.parents.Count; i++)
                    {
                        parent = node.parents [i];
                        if (parent is  Root)
                        {
                        }
                        else if (parent is NodeBranch)
                        {
                            if (((NodeBranch)parent).inLeft(node))
                            {
                                node.condition += ",{\"" + pubStr + (-node.parents [i].index) + "/" + 1 + "\"}";
                            }
                            if (((NodeBranch)parent).inRight(node))
                            {
                                node.condition += ",{\"" + pubStr + (-node.parents [i].index) + "/" + 2 + "\"}";
                            }
                        }
                        else
                        {
                            node.condition += ",{\"" + pubStr + (-node.parents [i].index) + "/" + 1 + "\"}";
                        }
                    }
                }
                node.condition += "}";
            }
            else
            {
                node.condition = "{{\"" + pubStr + node.index + "/" + 0 + "\"}}";
            }
            //result
            if (node is NodeBranch)
            {
                NodeBranch branch = node as NodeBranch;
                node.result1 = getResultWithSubNodes(branch, branch.ChildrenLeft, branch.KillLeftNodes);
                node.result2 = getResultWithSubNodes(branch, branch.ChildrenRight, branch.KillRightNodes);
            }
            else
            {
                node.result1 = getResultWithSubNodes(node, node.Children, node.KillNodes);
                node.result2 = node.result1;
            }
        }
Esempio n. 30
0
    void OnGUI()
    {
        if (!ECLProjectSetting.isProjectExit(ECLProjectManager.self))
        {
            GUIStyle style = new GUIStyle();
            style.fontSize         = 20;
            style.normal.textColor = Color.yellow;
            GUILayout.Label("The scene is not ready, create it now?", style);
            if (GUILayout.Button("Show Project Manager"))
            {
                EditorWindow.GetWindow <ECLProjectManager> (false, "CoolapeProject", true);
            }
            Close();
            return;
        }

        if (ECLProjectManager.data.hotUpgradeServers.Count > 0)
        {
            ECLEditorUtl.BeginContents();
            {
                List <string> toolbarNames = new List <string> ();
                for (int i = 0; i < ECLProjectManager.data.hotUpgradeServers.Count; i++)
                {
                    HotUpgradeServerInfor dd = ECLProjectManager.data.hotUpgradeServers [i] as HotUpgradeServerInfor;
                    toolbarNames.Add(dd.name);
                }
                selectedServerIndex = GUILayout.Toolbar(selectedServerIndex, toolbarNames.ToArray());
                HotUpgradeServerInfor hsi = ECLProjectManager.data.hotUpgradeServers [selectedServerIndex] as HotUpgradeServerInfor;
                selectedServer = hsi;
//						ECLProjectSetting.cellServerInor (hsi, false);
                //===================================================
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Key:", ECLEditorUtl.width200);
                    GUILayout.TextField(selectedServer.key);
                }
                GUILayout.EndHorizontal();
                //===================================================
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Hot Upgrade Base Url:", ECLEditorUtl.width200);
                    GUILayout.TextField(selectedServer.hotUpgradeBaseUrl);
                }
                GUILayout.EndHorizontal();
                //===================================================
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Host 4 Upload Upgrade Package:", ECLEditorUtl.width200);
                    GUILayout.TextField(selectedServer.host4UploadUpgradePackage);
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Port 4 Upload Upgrade Package:", ECLEditorUtl.width200);
                    EditorGUILayout.IntField(selectedServer.port4UploadUpgradePackage);
                }
                GUILayout.EndHorizontal();
            }
            ECLEditorUtl.EndContents();
        }

        if (selectedServer == null)
        {
            GUILayout.Label("Please select a server!");
            return;
        }

        EditorGUILayout.BeginHorizontal();
        {
            GUI.color = Color.green;
            if (GUILayout.Button("Refresh", GUILayout.Height(40f)))
            {
                setData();
            }
            GUI.color = Color.white;
            if (!isSelectMod)
            {
                if (GUILayout.Button("Save", GUILayout.Height(40f)))
                {
                    if (mList == null || mList.Count == 0)
                    {
                        Debug.LogWarning("Nothing need to save!");
                        return;
                    }
                    string str = JSON.JsonEncode(mList);
                    File.WriteAllText(Application.dataPath + "/" + cfgPath, str);
                }
            }
        }
        EditorGUILayout.EndHorizontal();

        ECLEditorUtl.BeginContents();
        {
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.LabelField("Package Name", GUILayout.Width(160));
                EditorGUILayout.LabelField("MD5", GUILayout.Width(250));
                EditorGUILayout.LabelField("Exist?", GUILayout.Width(40));
                EditorGUILayout.LabelField("Upload?", GUILayout.Width(60));
                EditorGUILayout.LabelField("...", GUILayout.Width(60));
                EditorGUILayout.LabelField("Notes");
            }
            EditorGUILayout.EndHorizontal();
            if (mList == null)
            {
                return;
            }
            scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(position.width), GUILayout.Height(position.height - 75));
            {
                for (int i = mList.Count - 1; i >= 0; i--)
                {
                    item = ListEx.getMap(mList, i);

                    EditorGUILayout.BeginHorizontal();
                    {
                        EditorGUILayout.TextField(MapEx.getString(item, "name"), GUILayout.Width(160));
                        EditorGUILayout.TextField(MapEx.getString(item, "md5"), GUILayout.Width(250));

                        if (!MapEx.getBool(item, "exist"))
                        {
                            GUI.color = Color.red;
                        }
                        EditorGUILayout.TextField(MapEx.getBool(item, "exist") ? "Yes" : "No", GUILayout.Width(40));
                        GUI.color = Color.white;
                        if (!isUploaded(item))
                        {
                            GUI.color = Color.red;
                        }
                        EditorGUILayout.TextField(isUploaded(item) ? "Yes" : "No", GUILayout.Width(60));
                        GUI.color = Color.white;
                        if (MapEx.getBool(item, "exist"))
                        {
                            GUI.enabled = true;
                        }
                        else
                        {
                            GUI.enabled = false;
                        }
                        GUI.color = Color.yellow;
                        if (isSelectMod)
                        {
                            if (GUILayout.Button("select", GUILayout.Width(60f)))
                            {
                                Close();
                                Utl.doCallback(onSelectedCallback, item, selectedCallbackParams);
                            }
                        }
                        else
                        {
                            if (GUILayout.Button("upload", GUILayout.Width(60f)))
                            {
                                if (EditorUtility.DisplayDialog("Alert", "Really want to upload the upgrade package?", "Okey", "cancel"))
                                {
                                    selectedPackageName = MapEx.getString(item, "name");
                                    uploadUpgradePackage(MapEx.getString(item, "name"));
                                }
                            }
                            if (GUILayout.Button("同步OSS", GUILayout.Width(60f)))
                            {
                                if (EditorUtility.DisplayDialog("Alert", "Really want to upload the upgrade package?", "Okey", "cancel"))
                                {
                                    uploadOss(MapEx.getString(item, "name"));
                                }
                            }
                        }

                        GUI.color       = Color.white;
                        GUI.enabled     = true;
                        item ["remark"] = EditorGUILayout.TextArea(MapEx.getString(item, "remark"));

                        GUILayout.Space(5);
                    }
                    EditorGUILayout.EndHorizontal();
                }
            }
            EditorGUILayout.EndScrollView();
        }
        ECLEditorUtl.EndContents();
    }