private GridProperties ConvertGridObject(string gridProperty)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            IEnumerable          div        = (IEnumerable)serializer.Deserialize(gridProperty, typeof(IEnumerable));
            GridProperties       gridProp   = new GridProperties();

            foreach (KeyValuePair <string, object> ds in div)
            {
                var property = gridProp.GetType().GetProperty(ds.Key, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase);

                if (ds.Key == "FacilityData")
                {
                    string str = Convert.ToString(ds.Value);
                    //currentData = JsonConvert.DeserializeObject<IEnumerable<View_A_Facility>>(str);
                    Module = "Facility details " + DateTime.Now.ToLongDateString();
                    cat    = "FacilityData";
                    continue;
                }
                if (ds.Key == "SCTO")
                {
                    string str = Convert.ToString(ds.Value);
                    currentData = JsonConvert.DeserializeObject <IEnumerable <fo_SCTO_ContactPerson> >(str);
                    Module      = "SCTO " + DateTime.Now.ToLongDateString();
                    continue;
                }
                if (property != null)
                {
                    Type   type      = property.PropertyType;
                    string serialize = serializer.Serialize(ds.Value);
                    object value     = serializer.Deserialize(serialize, type);
                    property.SetValue(gridProp, value, null);
                }
            }
            return(gridProp);
        }
Example #2
0
        public void ExportToPdf(string GridModel)
        {
            var orders = db.Orders
                         .Include(p => p.Client).Include(p => p.DeviceUser)
                         .OrderByDescending(o => o.OrderId)
                         .ToList()
                         .Select(s => new OrderViewModel()
            {
                OrderId          = s.OrderId,
                RemoteId         = s.RemoteId,
                SalesPersonCode  = s.DeviceUser.SalesPersonId,
                Status           = s.Status.ToString(),
                Total            = s.GetTotal(),
                CardCode         = s.Client.CardCode,
                Comment          = s.Comment,
                DeliveryDate     = s.DeliveryDate,
                DateCreated      = s.CreatedDate.ToShortDateString(),
                LastErrorMessage = s.LastErrorMessage
            });

            PdfExport exp = new PdfExport();

            GridProperties obj = (GridProperties)Syncfusion.JavaScript.Utils.DeserializeToModel(typeof(GridProperties), GridModel);

            exp.Export(obj, orders, "Export.pdf", false, false, "flat-saffron");
        }
Example #3
0
        public void ExportToExcel(string GridModel)
        {
            ExcelExport exp        = new ExcelExport();
            var         DataSource = (from job in db.JobsAssigneds
                                      join emp in db.EmployeeJobs
                                      on job.AssignID equals emp.AssignID
                                      select new
            {
                AssignID = job.AssignID,
                AssignJOBNUM = job.AssignJOBNUM,
                AssignCLIENT = job.AssignCLIENT,
                AssignWORK = job.AssignWORK,
                AssignAREA = job.AssignAREA,
                AssignINSTRUCTIONS = job.AssignINSTRUCTIONS,
                AssignTRUCK = job.AssignTRUCK,
                TextSENT = job.TextSENT,
                AssignSTARTTIME = job.AssignSTARTTIME,
                AssignENDTIME = job.AssignENDTIME,
                Hours = EntityFunctions.DiffHours(job.AssignSTARTTIME, job.AssignENDTIME),
                EmpNAME = emp.EmpNAME
            }).ToList();

            GridProperties obj = (GridProperties)Syncfusion.JavaScript.Utils.DeserializeToModel(typeof(GridProperties), GridModel);

            exp.Export(obj, DataSource, "Export.xlsx", ExcelVersion.Excel2010, false, false, "flat-saffron");
        }
Example #4
0
        public GridProperties ConvertGridObject(string gridProperty)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            IEnumerable          div        = (IEnumerable)serializer.Deserialize(gridProperty, typeof(IEnumerable));
            GridProperties       gridProp   = new GridProperties();

            foreach (KeyValuePair <string, object> ds in div)
            {
                var property = gridProp.GetType().GetProperty(ds.Key, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase);
                if (property != null)
                {
                    Type   type      = property.PropertyType;
                    string serialize = serializer.Serialize(ds.Value);
                    object value     = serializer.Deserialize(serialize, type);
                    property.SetValue(gridProp, value, null);
                }
            }

            AutoFormat auto = new AutoFormat()
            {
                HeaderBorderColor  = Color.FromArgb(206, 206, 206),
                ContentBorderColor = Color.FromArgb(206, 206, 206),
                GHeaderBorderColor = Color.FromArgb(206, 206, 206),
                GHeaderBgColor     = Color.LightGray,
                HeaderBgEndColor   = Color.FromArgb(236, 236, 236),
                GContentFontColor  = Color.FromArgb(51, 51, 51),
                AltRowBgColor      = Color.FromArgb(255, 255, 255),
                ContentBgColor     = Color.FromArgb(255, 255, 255)
            };

            gridProp.AutoFormat = auto;

            return(gridProp);
        }
        private GridProperties ConvertGridModelObject(string gridProperty)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            IEnumerable          div        = (IEnumerable)serializer.Deserialize(gridProperty, typeof(IEnumerable));
            GridProperties       gridProp   = new GridProperties();

            foreach (KeyValuePair <string, object> ds in div)
            {
                var property = gridProp.GetType().GetProperty(ds.Key, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase);
                if (property != null)
                {
                    Type   type      = property.PropertyType;
                    object value     = null;
                    string serialize = serializer.Serialize(ds.Value);
                    if (ds.Key == "childGrid")
                    {
                        value = ConvertGridModelObject(serialize);
                    }
                    else
                    {
                        value = serializer.Deserialize(serialize, type);
                    }
                    property.SetValue(gridProp, value, null);
                }
            }
            return(gridProp);
        }
Example #6
0
        private GridProperties ConvertGridObject(string gridProperty)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();

            serializer.MaxJsonLength = 2147483644;
            IEnumerable    div      = (IEnumerable)serializer.Deserialize(gridProperty, typeof(IEnumerable));
            GridProperties gridProp = new GridProperties();

            foreach (KeyValuePair <string, object> ds in div)
            {
                var property = gridProp.GetType().GetProperty(ds.Key, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase);
                if (ds.Key == "MyData")
                {
                    string str = Convert.ToString(ds.Value);
                    currentData = JsonConvert.DeserializeObject <IEnumerable <spView_crystal_lmis_StockStatusGetAll_Result> >(str);
                    continue;
                }

                if (property != null)
                {
                    Type   type      = property.PropertyType;
                    string serialize = serializer.Serialize(ds.Value);
                    object value     = serializer.Deserialize(serialize, type);
                    property.SetValue(gridProp, value, null);
                }
            }
            return(gridProp);
        }
        private GridProperties ConvertGridObject(string gridProperty)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();

            serializer.MaxJsonLength = Int32.MaxValue;
            IEnumerable    div      = (IEnumerable)serializer.Deserialize(gridProperty, typeof(IEnumerable));
            GridProperties gridProp = new GridProperties();

            foreach (KeyValuePair <string, object> ds in div)
            {
                var property = gridProp.GetType().GetProperty(ds.Key, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase);

                if (ds.Key == "ProductsData")
                {
                    string str = Convert.ToString(ds.Value);
                    // currentData = JsonConvert.DeserializeObject<IEnumerable<A_Product>>(str);
                    Module = "Medical Access Order Query All Products" + DateTime.Now.ToLongDateString();
                    continue;
                }

                if (property != null)
                {
                    Type   type      = property.PropertyType;
                    string serialize = serializer.Serialize(ds.Value);
                    object value     = serializer.Deserialize(serialize, type);
                    property.SetValue(gridProp, value, null);
                }
            }
            return(gridProp);
        }
Example #8
0
        public async Task ExportToExcel(string GridModel, string gridId, int id, string survey)
        {
            ExcelExport    exp = new ExcelExport();
            GridProperties obj = (GridProperties)Syncfusion.JavaScript.Utils.DeserializeToModel(typeof(GridProperties), GridModel);

            //Clear if there are any filter columns
            //syncfusion bug in exporting while in filter mode
            obj.FilterSettings.FilteredColumns.Clear();
            grid  = gridId;
            count = 0;

            if (gridId == "Surveys")
            {
                var surveys = await _prepareService.GetSurveys();

                var model       = QuestionnaireMapper.ToSurveyManageViewModel(surveys);
                var dataSource  = model.Surveys.ToList();
                var currentDate = DateTime.Today.ToShortDateString().Replace("/", "-");
                exp.Export(obj, dataSource, LocalizedStrings.GetString("Questionnaire") + " " /*"Questionnaire "*/ + currentDate + ".xlsx", ExcelVersion.Excel2013, false, false, "flat-saffron");
            }
            if (gridId == "SurveyItems")
            {
                var surveys = await _prepareService.GetSurveys(id);

                var data        = surveys.FirstOrDefault();
                var model       = QuestionnaireMapper.ToSurveyViewModel(data);
                var dataSource  = model.SurveyItems.ToList();
                var currentDate = DateTime.Today.ToShortDateString().Replace("/", "-");
                exp.Export(obj, dataSource, LocalizedStrings.GetString("Questionnaire") + " " /*"Questionnaire "*/ + survey + " " + currentDate + ".xlsx", ExcelVersion.Excel2013, false, false, "flat-saffron");
            }
        }
Example #9
0
        private GridProperties ConvertGridModel(string gridProperty)
        {
            GridProperties gridProp = new GridProperties();

            gridProp = (GridProperties)JsonConvert.DeserializeObject(gridProperty, typeof(GridProperties));
            return(gridProp);
        }
        public void ExportToExcel(string GridModel)
        {
            // IEnumerable datasource = db.A_Facilities.ToList();
            ExcelExport    exp = new ExcelExport();
            GridProperties obj = ConvertGridObject(GridModel);

            if (cat == "FacilityData")
            {
                currentData = db.View_A_Facility.ToList();
                obj.Columns[1].DataSource  = db.A_DeliveryZone.ToList();
                obj.Columns[2].DataSource  = db.A_ImplimentingPartners.ToList();
                obj.Columns[3].DataSource  = db.A_District.ToList();
                obj.Columns[8].DataSource  = db.A_Facility_Level_Of_Care.ToList();
                obj.Columns[9].DataSource  = db.A_ClientType.ToList();
                obj.Columns[11].DataSource = db.A_Ownership.ToList();
                obj.Columns[12].DataSource = db.A_CDCRegion.ToList();
                obj.Columns[13].DataSource = db.A_FacilityType.ToList();
                obj.Columns[16].DataSource = db.A_ImplimentingPartners.ToList();
                obj.Columns[17].DataSource = db.A_PatientLoad.ToList();
                //obj.Columns[21].DataSource = db.fo_SCTO.ToList();
            }

            //GridProperties obj = (GridProperties)Syncfusion.JavaScript.Utils.DeserializeToModel(typeof(GridProperties), GridModel);
            exp.Export(obj, currentData, Module + ".xlsx", ExcelVersion.Excel2010, false, false, "flat-saffron");
        }
Example #11
0
        public void ExportToExcelGenero(string GridModel)
        {
            ExcelExport    exp        = new ExcelExport();
            var            DataSource = context.Generoes.ToList();
            GridProperties obj        = (GridProperties)Syncfusion.JavaScript.Utils.DeserializeToModel(typeof(GridProperties), GridModel);

            exp.Export(obj, DataSource, "ExcelGenero.xlsx", Syncfusion.XlsIO.ExcelVersion.Excel2010, false, false, "flat-saffron");
        }
Example #12
0
        public void ExportToWordArtista(string GridModel)
        {
            WordExport     exp        = new WordExport();
            var            DataSource = context.Artistas.ToList();
            GridProperties obj        = (GridProperties)Syncfusion.JavaScript.Utils.DeserializeToModel(typeof(GridProperties), GridModel);

            exp.Export(obj, DataSource, "WordArtista.docx", false, false, "flat-saffron");
        }
Example #13
0
        public void ExportToPdfGenero(string GridModel)
        {
            PdfExport      exp        = new PdfExport();
            var            DataSource = context.Generoes.ToList();
            GridProperties obj        = (GridProperties)Syncfusion.JavaScript.Utils.DeserializeToModel(typeof(GridProperties), GridModel);

            exp.Export(obj, DataSource, "PDFGenero.pdf", false, false, "flat-saffron");
        }
    //NavGraph imgNavGraph;
    //GridProperties gPropImgNav;
    //GridProperties gPropWorldNav;
    public ImgNavToWorldNavGraphBuilder(ref NavGraph para_imgNavGraph,
	                                    ref GridProperties para_gPropImgNavGraph,
	                                    ref GridProperties para_gPropWorldNavGraph)
    {
        //imgNavGraph = para_imgNavGraph;
        //gPropImgNav = para_gPropImgNavGraph;
        //gPropWorldNav = para_gPropWorldNavGraph;
    }
        public void ExportToPdf(string GridModel)
        {
            PdfExport      exp        = new PdfExport();
            var            DataSource = new NorthwindDataContext().OrdersViews.Take(100).ToList();
            GridProperties obj        = ConvertGridObject(GridModel);

            exp.Export(obj, DataSource, "Export.pdf", false, false, "flat-saffron");
        }
Example #16
0
        // DataManager                      =>  GridProperties

        // SearchFilter
        // dataManager.Search[0].Fields     =>
        // dataManager.Search[0].Key        =>
        // dataManager.Search[0].Operator   =>

        // WhereFilter                          FilteredColumn
        // dataManager.Where[0].Field       =>  gridProperties.FilterSettings.FilteredColumns[0].Field
        // dataManager.Where[0].Operator    =>  gridProperties.FilterSettings.FilteredColumns[0].Operator
        // dataManager.Where[0].predicates  =>  gridProperties.FilterSettings.FilteredColumns[0].Predicate
        // dataManager.Where[0].value       =>  gridProperties.FilterSettings.FilteredColumns[0].Value

        // Sort                                 SortedColumn
        // dataManager.Sorted[0].Name       =>  gridProperties.SortSettings.SortedColumns[0].Field
        // dataManager.Sorted[0].Direction  =>  gridProperties.SortSettings.SortedColumns[0].Direction

        public static void ExportToExcel(string gridModel, IEnumerable data, string fileName, string theme)
        {
            GridProperties gridProperties = ModelToObject(gridModel);

            ExcelExport export = new ExcelExport();

            export.Export(gridProperties, data, fileName, ExcelVersion.Excel2013, false, false, theme);
        }
        public void ExportToExcel(string GridModel)
        {
            ExcelExport    exp        = new ExcelExport();
            var            DataSource = new NorthwindDataContext().OrdersViews.Take(100).ToList();
            GridProperties obj        = ConvertGridObject(GridModel);

            exp.Export(obj, DataSource, "Export.xlsx", ExcelVersion.Excel2010, false, false, "flat-saffron");
        }
Example #18
0
        public static void ExportToWord(string gridModel, IEnumerable data, string fileName, string theme)
        {
            GridProperties gridProperties = ModelToObject(gridModel);

            WordExport export = new WordExport();

            export.Export(gridProperties, data, fileName, false, false, theme);
        }
    public ImgToWorldNavGraphBuilder(string para_imgPath,
	                                 int[] para_mapDimensions,
	                                 GridProperties para_worldGProp)
    {
        imgPath = para_imgPath;
        //mapDimensions = para_mapDimensions;
        worldGProp = para_worldGProp;
        traversibleColor = this.convertColor(new int[4] {0,0,0,255});
    }
Example #20
0
        public static void ExportToPdf(string gridModel, IEnumerable data, string fileName, string theme)
        {
            GridProperties gridProperties = ModelToObject(gridModel);

            PdfExport export = new PdfExport();

            export.Export(gridProperties, data, fileName, false, false, true, theme); // UNICODE = true
            //export.Export(gridProperties, data, fileName, false, false, theme);
        }
        public void ExcelAction(string GridModel)

        {
            ExcelExport exp = new ExcelExport();

            messageListVM = new List <ChatMessageViewModel>();

            messageList = db.ChatMessages.ToList();
            appUserList = db.AppUserModels.ToList();
            groupList   = db.GroupModels.ToList();

            ChatMessageViewModel chatMessage = new ChatMessageViewModel();

            foreach (ChatMessage u in messageList)
            {
                chatItem = new ChatMessageViewModel();

                user  = appUserList.Find(x => x.ID == u.UserId);
                group = groupList.Find(x => x.ID == u.GroupId);

                chatItem.Id        = u.ChatId;
                chatItem.Date      = u.TimeStamp.ToShortDateString();
                chatItem.Time      = u.TimeStamp.ToLongTimeString();
                chatItem.Name      = u.Name;
                chatItem.Message   = u.Message;
                chatItem.isFlagged = u.isFlagged;


                if (user != null)
                {
                    chatItem.UserName = user.Name;
                }
                else
                {
                    chatItem.UserName = u.Name;
                }

                if (group != null)
                {
                    chatItem.GroupName = group.GroupName;
                }
                else
                {
                    chatItem.GroupName = "**deleted**";
                }


                messageListVM.Add(chatItem);
            }



            var            DataSource = messageListVM.ToList();
            GridProperties obj        = (GridProperties)Syncfusion.JavaScript.Utils.DeserializeToModel(typeof(GridProperties), GridModel);

            exp.Export(obj, DataSource, "Export.xlsx", ExcelVersion.Excel2010, false, false, "flat-saffron");
        }
Example #22
0
            /// <summary>
            /// overriden to draw the button for this cell.
            /// </summary>
            /// <param name="button">instance of the gridcellbutton to be drawn</param>
            /// <param name="g">graphics associated with this control</param>
            /// <param name="rowIndex">rowIndex of this cell in grid</param>
            /// <param name="colIndex">colIndex of this cell in grid</param>
            /// <param name="bActive">boolean value</param>
            /// <param name="style">style information of this cell</param>
            protected override void OnDrawCellButton(GridCellButton button, Graphics g, int rowIndex, int colIndex, bool bActive, GridStyleInfo style)
            {
                Point          ptOffset       = new Point(1, 1);
                GridProperties propertyObject = Grid.Model.Properties;

                Rectangle faceRect = button.Bounds;

                faceRect.Inflate(-2, -1);
            }
        public void ColumnTemplateExportToExcel(string GridModel)
        {
            ExcelExport    exp        = new ExcelExport();
            var            DataSource = new NorthwindDataContext().EmployeeViews.Take(8).ToList();
            GridProperties obj        = ConvertGridObject3(GridModel);

            obj.ExcelColumnTemplateInfo = ExceltemplateInfo;
            exp.Export(obj, DataSource, "Export.xlsx", ExcelVersion.Excel2010, false, true, "flat-saffron");
        }
        public void ColumnTemplateToWord(string GridModel)
        {
            WordExport     exp        = new WordExport();
            var            DataSource = new NorthwindDataContext().EmployeeViews.Take(8).ToList();
            GridProperties obj        = ConvertGridObject3(GridModel);

            obj.WordColumnTemplateInfo = WordTemplateInfo;
            exp.Export(obj, DataSource, "Export.docx", false, true, "flat-saffron");
        }
        public void ColumnTemplateExportToPdf(string GridModel)
        {
            PdfExport      exp        = new PdfExport();
            var            DataSource = new NorthwindDataContext().EmployeeViews.Take(8).ToList();
            GridProperties obj        = ConvertGridObject(GridModel);

            obj.PdfColumnTemplateInfo = PdfTemplateInfo;
            exp.Export(obj, DataSource, "Export.pdf", false, true, "flat-saffron");
        }
Example #26
0
        public void ExcelExport()
        {
            string              gridModel    = HttpContext.Current.Request.Params["GridModel"];
            GridProperties      gridProperty = ConvertGridObject(gridModel);
            ExcelExport         exp          = new ExcelExport();
            IEnumerable <Order> result       = db.Orders.ToList();

            exp.Export(gridProperty, result, "Export.xlsx", ExcelVersion.Excel2010, false, false, "flat-saffron");
        }
Example #27
0
        public ActionResult ExportToWord(string GridModel)
        {
            WordExport     exp        = new WordExport();
            var            DataSource = _context.Orders.Take(100).ToList();
            GridProperties gridProp   = ConvertGridObject(GridModel);
            GridWordExport wrdExp     = new GridWordExport();

            wrdExp.FileName = "Export.docx"; wrdExp.Theme = "flat-saffron";
            return(exp.Export(gridProp, DataSource, wrdExp));
        }
Example #28
0
        public ActionResult ExportToPdf(string GridModel)
        {
            PdfExport      exp        = new PdfExport();
            var            DataSource = _context.Orders.Take(100).ToList();
            GridProperties gridProp   = ConvertGridObject(GridModel);
            GridPdfExport  pdfExp     = new GridPdfExport();

            pdfExp.FileName = "Export.pdf"; pdfExp.Theme = "flat-saffron";
            return(exp.Export(gridProp, DataSource, pdfExp));
        }
Example #29
0
        public void ExportToWord(string GridModel)
        {
            WordExport exp        = new WordExport();
            var        DataSource = TempData["ExportData"];

            TempData["ExportData"] = DataSource;
            GridProperties obj = (GridProperties)Syncfusion.JavaScript.Utils.DeserializeToModel(typeof(GridProperties), GridModel);

            exp.Export(obj, DataSource, "Export.docx", false, false, "flat-saffron");
        }
Example #30
0
        public void ExportToExcel(string GridModel)
        {
            ExcelExport exp        = new ExcelExport();
            var         DataSource = TempData["ExportData"];

            TempData["ExportData"] = DataSource;
            GridProperties obj = (GridProperties)Syncfusion.JavaScript.Utils.DeserializeToModel(typeof(GridProperties), GridModel);

            exp.Export(obj, DataSource, "Export.xlsx", ExcelVersion.Excel2010, false, false, "flat-saffron");
        }
        protected void EmployeesGrid_ServerWordExporting(object sender, Syncfusion.JavaScript.Web.GridEventArgs e)
        {
            WordExport     exp  = new WordExport();
            GridProperties obj  = ConvertGridObject(e.Arguments["model"].ToString());
            GridWordExport exp1 = new GridWordExport()
            {
                IsTemplateColumnIncluded = true, IsHideColumnIncude = false, Theme = "flat-lime", FileName = "Export.docx"
            };

            exp.Export(obj, (IEnumerable)EmployeesGrid.DataSource, exp1);
        }
        protected void ExportToExcel(string gridModel, IEnumerable data, string theme, string fileName)
        {
            GridProperties gridProperties = SyncfusionGrid.ModelToObject(gridModel);

            ExcelExport export = new ExcelExport();
            IWorkbook   excel  = export.Export(gridProperties, data, fileName, ExcelVersion.Excel2013, false, false, theme, true);

            excel.ActiveSheet.DeleteRow(1, 1);
            excel.SaveAs(fileName, ExcelSaveType.SaveAsXLS, System.Web.HttpContext.Current.Response, ExcelDownloadType.Open);
            //excel.SaveAs(fileName, ExcelSaveType.SaveAsXLS, Controller.Response, ExcelDownloadType.Open);
        }
Example #33
0
    /**
     * 	Setup all the different elements:
     *  ground plane, grid cells, etc.
     *
     */
    public static void Setup(GridProperties gridProperties)
    {
        groundPlane = gridProperties.groundObject;

        groundPlaneSizeX = gridProperties.groundPlaneSizeX;
        groundPlaneSizeY = gridProperties.groundPlaneSizeY;

        gridCellSize = gridProperties.gridCellSize;

        SetupGroundPlane(gridProperties.gridMaterial);
        SetupGridArray();
    }
    public void init(List<int> para_charIDsToUnlockInWorld,
	                 int[] para_mapSize,
	                 GridProperties para_gPropMapWorldBounds,
	                 ColoredNavGraph para_worldNavGraph,
	                 ITerrainHandler para_terrHandle)
    {
        charIDsToUnlockInWorld = para_charIDsToUnlockInWorld;
        mapSize = para_mapSize;
        gPropMapWorldBounds = para_gPropMapWorldBounds;
        worldNavGraph = para_worldNavGraph;
        terrainHandle = para_terrHandle;

        performInitialDelay();
    }
Example #35
0
 public GridProperties ConvertGridObject(string gridProperty)
 {
     JavaScriptSerializer serializer = new JavaScriptSerializer();
     IEnumerable div = (IEnumerable)serializer.Deserialize(gridProperty, typeof(IEnumerable));
     GridProperties gridProp = new GridProperties();
     foreach (KeyValuePair<string, object> ds in div)
     {
         var property = gridProp.GetType().GetProperty(ds.Key, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase);
         if (property != null)
         {
             Type type = property.PropertyType;
             string serialize = serializer.Serialize(ds.Value);
             object value = serializer.Deserialize(serialize, type);
             property.SetValue(gridProp, value, null);
         }
     }
     return gridProp;
 }
Example #36
0
    public void performFetchWordSequence(string para_word,
	                                     GridProperties para_dropGridWorldGProp,
	                                     Transform para_textPlanePrefab,
	                                     Transform para_splitDetectorPrefab,
	                                     Transform[] para_itemToSplitPrefabArr,
	                                     Transform para_framePrefab,
	                                     Transform para_glowPrefab,
	                                     Transform para_nettingPrefab)
    {
        word = para_word;
        dropGridWorldGProp = para_dropGridWorldGProp;
        textPlanePrefab = para_textPlanePrefab;
        splitDetectorPrefab = para_splitDetectorPrefab;
        itemToSplitPrefabArr = para_itemToSplitPrefabArr;
        framePrefab = para_framePrefab;
        glowPrefab = para_glowPrefab;
        nettingPrefab = para_nettingPrefab;

        hurryFlag = false;

        exitScene();
    }
Example #37
0
    public static void createGridRender(GridProperties para_gProp,
	                             		Transform para_planePrefab,
	                             		bool[] para_upAxisArr)
    {
        GridProperties worldGProp = para_gProp;
        Transform planePrefab = para_planePrefab;
        bool[] upAxisArr = para_upAxisArr;

        GameObject gridGObj = new GameObject("DropGrid");
        GameObject gridGObj_back = new GameObject("BackgroundGrid");
        GameObject gridGObj_frontBorder = new GameObject("FrontBorder");

        float depthVal_gridMajorOverlay = para_gProp.z;
        float depthVal_gridMinorOverlay = para_gProp.z - 0.5f;

        Texture2D majorGridLineTex = new Texture2D(1,1);
        majorGridLineTex.SetPixel(0,0,Color.black);
        majorGridLineTex.Apply();

        Texture2D minorGridLineTex = new Texture2D(1,1);
        minorGridLineTex.SetPixel(0,0,Color.gray);
        minorGridLineTex.Apply();

        //Instantiate(planePrefab,new Vector3(worldGProp.x,worldGProp.y,Camera.main.transform.position.z + depthVal_grid),Quaternion.identity);

        // Create minor grid lines.
        Rect tmpObjWorldBounds = new Rect(worldGProp.x,worldGProp.y,worldGProp.borderThickness,worldGProp.totalHeight);
        for(int c=0; c<(worldGProp.widthInCells+1); c++)
        {
            tmpObjWorldBounds.x = (worldGProp.x + (c * (worldGProp.cellWidth + worldGProp.borderThickness)));
            GameObject gridLineObj = WorldSpawnHelper.initObjWithinWorldBounds(planePrefab,1,1,"GridBorder_(x="+c+")",tmpObjWorldBounds,null,Camera.main.transform.position.z + depthVal_gridMinorOverlay,upAxisArr);
            gridLineObj.transform.renderer.material.mainTexture = minorGridLineTex;
            gridLineObj.transform.parent = gridGObj_back.transform;
        }

        tmpObjWorldBounds = new Rect(worldGProp.x,worldGProp.y,worldGProp.totalWidth,worldGProp.borderThickness);
        for(int r=0; r<(worldGProp.heightInCells+1); r++)
        {
            tmpObjWorldBounds.y = (worldGProp.y - (r * (worldGProp.cellHeight + worldGProp.borderThickness)));
            GameObject gridLineObj = WorldSpawnHelper.initObjWithinWorldBounds(planePrefab,1,1,"GridBorder_(y="+r+")",tmpObjWorldBounds,null,Camera.main.transform.position.z + depthVal_gridMinorOverlay,upAxisArr);
            gridLineObj.transform.renderer.material.mainTexture = minorGridLineTex;
            gridLineObj.transform.parent = gridGObj_back.transform;
        }

        // Create major grid lines.
        List<Rect> majorGridLineBounds = new List<Rect>();
        majorGridLineBounds.Add( new Rect(worldGProp.x,worldGProp.y - worldGProp.totalHeight + worldGProp.borderThickness,worldGProp.totalWidth,worldGProp.borderThickness) );
        majorGridLineBounds.Add( new Rect(worldGProp.x,worldGProp.y,worldGProp.borderThickness,worldGProp.totalHeight) );
        majorGridLineBounds.Add( new Rect(worldGProp.x + worldGProp.totalWidth - worldGProp.borderThickness,worldGProp.y,worldGProp.borderThickness,worldGProp.totalHeight) );
        majorGridLineBounds.Add( new Rect(worldGProp.x,worldGProp.y,worldGProp.totalWidth,worldGProp.borderThickness) );

        for(int i=0; i<majorGridLineBounds.Count; i++)
        {
            GameObject tmpGridBorder = WorldSpawnHelper.initObjWithinWorldBounds(planePrefab,1,1,"GridBorderMain",majorGridLineBounds[i],null,Camera.main.transform.position.z + depthVal_gridMajorOverlay,upAxisArr);
            tmpGridBorder.transform.renderer.material.mainTexture = majorGridLineTex;
            tmpGridBorder.transform.parent = gridGObj_frontBorder.transform;
        }

        gridGObj_back.transform.parent = gridGObj.transform;
        gridGObj_frontBorder.transform.parent = gridGObj.transform;

        gridGObj.SetActive(false);
    }
Example #38
0
    void Start()
    {
        float iconifiedBounds_Width = Screen.width * 0.15f;
        float iconifiedBounds_Height = Screen.height * 0.15f;
        if(iconifiedBounds_Width > iconifiedBounds_Height) { iconifiedBounds_Width = iconifiedBounds_Height; }
        else { iconifiedBounds_Height = iconifiedBounds_Width; }
        float iconifiedBounds_X = Screen.width - iconifiedBounds_Width;
        float iconifiedBounds_Y = Screen.height - iconifiedBounds_Height;

        clickableArea = new Rect(iconifiedBounds_X,iconifiedBounds_Y,iconifiedBounds_Width,iconifiedBounds_Height);

        walkers = new GameObject[LocalisationMang.getNPCnames().Count];
        visibleWalkers = new List<int>();

        isPaused = false;
        currPlayerDestCell = new int[2] {-1,-1};
        playerNavigationFlag = true;

        dialogEventRequired = false;
        dialogTargetCharID = -1;

        // Disable any debug scene related things.
        makeAllClickablesTransparent();

        // Apply Clothing Config to Main Avatar.
        applyPlayerAvatarClothing();
        clonePlayerAv();

        // Calculate World Bounds.
        gPropMapWorldBounds = calculateWorldMapBounds(mapSize);
        WorldSpawnHelper.initObjWithinWorldBounds(blankCollisionBox,
                                                  blankCollisionBox.transform.renderer.bounds.size.x,
                                                  blankCollisionBox.transform.renderer.bounds.size.y,
                                                  "WorldColBox",
                                                  new Rect(gPropMapWorldBounds.x,gPropMapWorldBounds.y,gPropMapWorldBounds.totalWidth,gPropMapWorldBounds.totalHeight),
                                                  null,
                                                  gPropMapWorldBounds.z,
                                                  upAxisArr);

        // Remove Scroll Cam and use Follow Cam.
        Destroy(GameObject.Find("GlobObj").GetComponent(typeof(ScrollCam)));
        FollowScript followScrpt = Camera.main.transform.gameObject.AddComponent<FollowScript>();
        followScrpt.init(GameObject.Find("MainAvatar"),new bool[3] { true, true, false });

        // Init Nav Graph.
        string bnwMapFilePath = "Textures/WorldView/WorldView_B&W";
        ImgToWorldNavGraphBuilderV2 navBuilder = new ImgToWorldNavGraphBuilderV2(bnwMapFilePath,gPropMapWorldBounds);
        List<ColorGraphTypeInfo> graphRequirements = new List<ColorGraphTypeInfo>()
        {
            new ColorGraphTypeInfo(new string[] { "FreeSpace", "MainCharacterSpawns" },
            new Color[] { Color.white, Color.red })
        };
        List<ColoredNavGraph> graphList = navBuilder.constructColorGraphs(graphRequirements);
        worldNavGraph = graphList[0];

        List<System.Object> paramList = new List<System.Object>();
        paramList.Add(worldNavGraph);
        paramList.Add(gPropMapWorldBounds);
        terrainHandle = new BasicTerrainHandler();
        terrainHandle.constructTerrainStructures(paramList);

        Animator mainPlayerAvatarAni = GameObject.Find("MainAvatar").GetComponent<Animator>();
        //mainPlayerAvatarAni.Play("MainAvatar_walkDown");
        mainPlayerAvatarAni.speed = 0;

        SoundPlayerScript sps = transform.GetComponent<SoundPlayerScript>();
        //sps.triggerSoundLoopAtCamera("WindAmbient","WorldAmbientBox",0.3f,true);
        ambientSound = sps.triggerSoundLoopAtCamera("Serenade Band Tracks/Serenade_Bass_01.00","WorldAmbientBox",0.3f,true);

        // Init input detectors.
        inputDetectors = new List<AbsInputDetector>();
        ClickDetector cd = transform.gameObject.AddComponent<ClickDetector>();
        cd.registerListener("WorldScript",this);
        cd.setMaxDelayBetweenClicks(0.0001f);
        inputDetectors.Add(cd);

        // Persistent Obj Check.

        int index = 0;

        //Hide all recognised characters and destroy extra ones
        foreach(string para_namePrefix in new string[]{"AvatarChar-","SecChar-"}){

            int counter = 0;
            bool foundItem = true;
            while(foundItem)
            {
                GameObject tmpObj = GameObject.Find(para_namePrefix+""+counter);
                counter++;
                if(tmpObj == null)
                {
                    foundItem = false;
                }
                else
                {
                    if(index >= walkers.Length){
                        Destroy(tmpObj);

                    }else{
                        rootItemToMapGrid(tmpObj);
                        walkers[index++] = tmpObj;
                        List<SpriteRenderer> sRends = CommonUnityUtils.getSpriteRendsOfChildrenRecursively(tmpObj);
                        if(sRends != null)
                        {
                            for(int i=0; i<sRends.Count; i++)
                            {
                                sRends[i].enabled = false;
                            }
                        }
                        tmpObj.collider.enabled = false;
                    //tmpObj.SetActive(false);
                    }
                }

            }
        }

        isStillPerformingUnlockSequence = false;

        GameObject poRef = PersistentObjMang.getInstance();
        control = poRef.GetComponent<ProgressScript>();
        if(control == null)
        {
            control = poRef.AddComponent<ProgressScript>();
        }/*else{
            Debug.Log("Enable progress script");
            control.enabled = true;
        }*/

        Debug.LogWarning("Position of avatar not initialised");
        //placeExistingItemInCell("MainAvatar",int[]{});//NEW
        control.attemptActivityDebrief(this);

        // Switch player controls off until the intro effect is over.
        togglePlayerInputState(false);
        setupReady = false;

        Debug.Log("Fading removed");

        respondToEvent("", "FadeEffectDone", null);
    }
Example #39
0
    public void init(Transform para_monkeyPrefab,
	                 Transform para_sfxPrefab,
						   int[] para_mapSize,
	                 	   GridProperties para_gPropMapWorldBounds,
	                 	   ColoredNavGraph para_worldNavGraph,
	                       ITerrainHandler para_terrainHandle)
    {
        monkeyPrefab = para_monkeyPrefab;
        sfxPrefab = para_sfxPrefab;
        mapSize = para_mapSize;
        gPropMapWorldBounds = para_gPropMapWorldBounds;
        worldNavGraph = para_worldNavGraph;
        terrainHandle = para_terrainHandle;
        //playerAvatar = GameObject.Find("MainAvatar");

        // Spatial hash monkey spawn pts.
        monkeySpawnLocHasher = new SpatialHasher(new GridProperties(new float[3] {gPropMapWorldBounds.x,gPropMapWorldBounds.y,gPropMapWorldBounds.z},0,gPropMapWorldBounds.totalWidth/4f,gPropMapWorldBounds.totalHeight/4f,4,4));
        List<int> monkeySpawnNodeIDs = worldNavGraph.getNodesOfType(worldNavGraph.getTypeIDByName("MonkeySpawn"));
        for(int i=0; i<monkeySpawnNodeIDs.Count; i++)
        {
            WorldNode tmpNode = (WorldNode) worldNavGraph.getNode(monkeySpawnNodeIDs[i]);
            Vector3 tmpWorldPt = tmpNode.getWorldPt();
            monkeySpawnLocHasher.insertItem(tmpNode.getNodeID(),new Vector2(tmpWorldPt.x,tmpWorldPt.y));
        }

        // Spawn Monkeys.
        spawnMonkeys();
    }
    protected override void initWorld()
    {
        // Auto Adjust.

        GameObject tmpPackageUIIcon = GameObject.Find("PackageUIIcon");
        GameObject tmpBananaUIIcon = GameObject.Find("BananaUIIcon");
        GameObject tmpPersonPortrait = GameObject.Find("PersonPortrait");
        GameObject tmpPauseButton = GameObject.Find("PauseButton");
        GameObject tmpBackdrop = GameObject.Find("Backdrop").gameObject;
        SpawnNormaliser.adjustGameObjectsToNwBounds(SpawnNormaliser.get2DBounds(tmpBackdrop.renderer.bounds),
                                                    WorldSpawnHelper.getCameraViewWorldBounds(tmpBackdrop.transform.position.z,true),
                                                    new List<GameObject>() { tmpPackageUIIcon, tmpBananaUIIcon, tmpPersonPortrait, tmpBackdrop });

        tmpPackageUIIcon.transform.parent = GameObject.Find("Main Camera").transform;
        tmpBananaUIIcon.transform.parent = GameObject.Find("Main Camera").transform;
        tmpPersonPortrait.transform.parent = GameObject.Find("Main Camera").transform;
        tmpPauseButton.transform.parent = GameObject.Find("Main Camera").transform;

        tmpPackageUIIcon.transform.FindChild("PackageUICounter").gameObject.renderer.sortingOrder = (tmpPackageUIIcon.renderer.sortingOrder+1);
        tmpBananaUIIcon.transform.FindChild("BananaUICounter").gameObject.renderer.sortingOrder = (tmpBananaUIIcon.renderer.sortingOrder+1);
        CommonUnityUtils.setSortingOrderOfEntireObject(tmpPersonPortrait,100);
        CommonUnityUtils.setSortingOrderOfEntireObject(tmpPauseButton,200);

        uiBounds.Add("PackageCounter",WorldSpawnHelper.getWorldToGUIBounds(tmpPackageUIIcon.renderer.bounds,upAxisArr));
        uiBounds.Add("PersonPortrait",WorldSpawnHelper.getWorldToGUIBounds(tmpPersonPortrait.renderer.bounds,upAxisArr));
        uiBounds.Add("PauseBtn",WorldSpawnHelper.getWorldToGUIBounds(tmpPauseButton.renderer.bounds,upAxisArr));
        Destroy(tmpBackdrop);

        // Init world bounds data.
        gPropMapWorldBounds = calculateWorldMapBounds(mapSize);
        WorldSpawnHelper.initObjWithinWorldBounds(blankCollisionBox,
                                                  blankCollisionBox.transform.renderer.bounds.size.x,
                                                  blankCollisionBox.transform.renderer.bounds.size.y,
                                                  "WorldColBox",
                                                  new Rect(gPropMapWorldBounds.x,gPropMapWorldBounds.y,gPropMapWorldBounds.totalWidth,gPropMapWorldBounds.totalHeight),
                                                  null,
                                                  gPropMapWorldBounds.z,
                                                  upAxisArr);

        // Init Nav Graph.
        string bnwMapFilePath = "Textures/AcDelivery/Map";
        ImgToWorldNavGraphBuilderV2 navBuilder = new ImgToWorldNavGraphBuilderV2(bnwMapFilePath,gPropMapWorldBounds);

        List<ColorGraphTypeInfo> graphRequirements = new List<ColorGraphTypeInfo>()
        {
            new ColorGraphTypeInfo(new string[] { "FreeSpace", "MonkeySpawn", "HouseDeliveryPoint", "PlayerSpawn" },
                                   new Color[] { Color.white, ColorUtils.convertColor(153,76,0), Color.blue, Color.red })
        };

        List<ColoredNavGraph> graphList = navBuilder.constructColorGraphs(graphRequirements);
        worldNavGraph = graphList[0];

        List<System.Object> paramList = new List<System.Object>();
        paramList.Add(worldNavGraph);
        paramList.Add(gPropMapWorldBounds);
        terrainHandle = new BasicTerrainHandler();
        terrainHandle.constructTerrainStructures(paramList);

        // Render Nav Graph. (For Debug Purposes).
        //GameObject navGraphRenderObj = NavGraphUnityUtils.renderNavGraph("WorldNavGraphRender",worldNavGraph,graphNodePrefab);
        //navGraphRenderObj.SetActive(false);

        // Spawn Player.
        List<int> playerSpawnPtList = worldNavGraph.getNodesOfType(worldNavGraph.getTypeIDByName("PlayerSpawn"));
        WorldNode playerSpawnNode = (WorldNode) worldNavGraph.getNode(playerSpawnPtList[Random.Range(0,playerSpawnPtList.Count)]);
        Vector3 tmpV = playerSpawnNode.getWorldPt();
        Vector3 playerSpawnPt = new Vector3(tmpV.x,tmpV.y,-2f);
        Transform nwPlayerAvatar = (Transform) Instantiate(mainAvatarPrefab,playerSpawnPt,Quaternion.identity);
        nwPlayerAvatar.gameObject.name = "MainAvatar";
        NewCharacterNavMovement cnm = nwPlayerAvatar.gameObject.AddComponent<NewCharacterNavMovement>();
        cnm.faceDirection("S");

        // Apply player clothing.
        applyPlayerAvatarClothing();

        // Spawn MonkeyManager.
        PDMonkeyManager monkeyMang = transform.gameObject.AddComponent<PDMonkeyManager>();
        monkeyMang.init(monkeyPrefab,sfxPrefab,mapSize,gPropMapWorldBounds,worldNavGraph,terrainHandle);

        // Input detectors.
        inputDetectors = new List<AbsInputDetector>();
        ClickDetector cd = transform.gameObject.AddComponent<ClickDetector>();
        cd.setMaxDelayBetweenClicks(0.01f);
        cd.registerListener("AcScen",this);
        inputDetectors.Add(cd);

        // Mechanics variables.
        currNumKnocks = 0;
        mainCam = GameObject.Find("Main Camera").GetComponent<Camera>();
        numOfPackagesInInventory = reqDeliveriesForWin;
        numOfBananasInInventory = 30;
        refreshInventoryCounterDisplay();
        stolenPackageToMonkeyQueue = new List<string[]>();
        stoleQueueIndexPointer = 0;

        // Select prefabs for packages.
        selectedPackagePrefabIndexes = new List<int>();
        for(int i=0; i<reqDeliveriesForWin; i++)
        {
            selectedPackagePrefabIndexes.Add(Random.Range(0,packagePrefabs.Length));
        }
    }
    private GridProperties calculateWorldMapBounds(int[] para_mapDimensions)
    {
        int counter = 1;
        bool hasFoundAdditionalMapSegment = true;
        List<Bounds> segmentBoundsList = new List<Bounds>();
        while(hasFoundAdditionalMapSegment)
        {
            GameObject mapSegment = GameObject.Find("WorldView_Map"+counter);
            if(mapSegment == null)
            {
                hasFoundAdditionalMapSegment = false;
            }
            else
            {
                segmentBoundsList.Add(mapSegment.renderer.bounds);
            }
            counter++;
        }
        Bounds mapWorldBounds = findMaxBounds(segmentBoundsList);
        Vector3 mapWorldBounds_TL = (mapWorldBounds.center) + new Vector3(-(mapWorldBounds.size.x/2f),(mapWorldBounds.size.y/2f),0);
        GridProperties reqGProp = new GridProperties(new Rect(mapWorldBounds_TL.x,mapWorldBounds_TL.y,mapWorldBounds.size.x,mapWorldBounds.size.y),para_mapDimensions[0],para_mapDimensions[1],0,0);
        reqGProp.z = mapWorldBounds.center.z;

        return reqGProp;
    }
    public ImgToWorldNavGraphBuilderV2(string para_imgPath,
	                                   GridProperties para_worldGProp)
    {
        imgPath = para_imgPath;
        worldGProp = para_worldGProp;
    }
Example #43
0
    public void init(int[] para_mapSize,
			         GridProperties para_gPropMapWorldBounds,
					 ColoredNavGraph para_worldNavGraph,
	                 ITerrainHandler para_terrainHandle,
	                 Transform para_sfxPrefab)
    {
        //mapSize = para_mapSize;
        gPropMapWorldBounds = para_gPropMapWorldBounds;
        worldNavGraph = para_worldNavGraph;
        terrainHandle = para_terrainHandle;
        sfxPrefab = para_sfxPrefab;
    }
Example #44
0
    private void emitNewWord(string para_word,
	                         GridProperties para_dropGridWorldGProp,
	                         Transform para_textPlanePrefab,
	                         Transform para_splitDetectorPrefab,
	                         Transform[] para_itemToSplitPrefabArr,
	                         Transform para_framePrefab,
	                         Transform para_glowPrefab)
    {
        GameObject chuteGObj = GameObject.Find("BigPipe");

        int wordLength = para_word.Length;
        GridProperties dropGrid_WorldGProp = para_dropGridWorldGProp;

        GameObject emitAreaGOBj = GameObject.Find("WordEmitArea");
        Rect emitAreaWorld = CommonUnityUtils.get2DBounds(emitAreaGOBj.renderer.bounds);

        float totalBlockWidth = ((dropGrid_WorldGProp.cellWidth + dropGrid_WorldGProp.borderThickness) * wordLength);
        float totalBlockHeight = dropGrid_WorldGProp.cellHeight;

        growScale = Mathf.Min( (emitAreaWorld.width/totalBlockWidth), (emitAreaWorld.height/totalBlockHeight) );
        float destWidth = (totalBlockWidth * growScale);
        float destHeight = (totalBlockHeight * growScale);
        destGrowRect = new Rect(emitAreaWorld.x + (emitAreaWorld.width/2f) - (destWidth/2f), emitAreaWorld.y - (emitAreaWorld.height/2f) + (destHeight/2f),destWidth,destHeight);

        GameObject backgroundGObj = GameObject.Find("Background");
        Rect background2DBounds = CommonUnityUtils.get2DBounds(backgroundGObj.renderer.bounds);
        chuteGObj.transform.position = new Vector3(background2DBounds.x - (destGrowRect.width/2f),
                                                   chuteGObj.transform.position.y,
                                                   chuteGObj.transform.position.z);

        Vector3 spawnPosForWord = new Vector3(chuteGObj.transform.position.x,
                                              chuteGObj.transform.position.y - (chuteGObj.renderer.bounds.size.y/2f) - (destGrowRect.height/2f),
                                              chuteGObj.transform.position.z);

        // Spawn word.
        GameObject nwConveyorWordGObj = WordFactoryYUp.spawnSplittableWordBoard(para_word,
                                                                                spawnPosForWord,
                                                                                dropGrid_WorldGProp.cellWidth,
                                                                                dropGrid_WorldGProp.borderThickness,
                                                                                -1,
                                                                                new bool[] {true,true,true},
        new bool[] {false,true,false},
        para_textPlanePrefab,
        para_splitDetectorPrefab,
        para_itemToSplitPrefabArr,
        null,
        para_framePrefab,
        para_glowPrefab);

        Vector3 tmpLocalScale = nwConveyorWordGObj.transform.localScale;
        tmpLocalScale.x *= growScale;
        tmpLocalScale.y *= growScale;
        tmpLocalScale.z *= growScale;
        nwConveyorWordGObj.transform.localScale = tmpLocalScale;

        SplittableBlockUtil.setStateOfSplitDetectsForWord(nwConveyorWordGObj,false);

        GameObject wordHolder = new GameObject("WordHolder");
        nwConveyorWordGObj.transform.parent = wordHolder.transform;

        // Apply netting to the word.
        GameObject nettingParent = new GameObject("Netting");
        nettingParent.transform.position = new Vector3(spawnPosForWord.x,spawnPosForWord.y,spawnPosForWord.z);
        int numOfReqNetting = wordLength++;
        float totRequiredNettingWidth = destGrowRect.width;
        float netting_X = spawnPosForWord.x - (totRequiredNettingWidth/2f);
        float netting_Y = spawnPosForWord.y + (destGrowRect.height/2f);
        float netting_Height = destGrowRect.height;
        float netting_Width = netting_Height;
        Rect nettingBounds = new Rect(netting_X,netting_Y,netting_Width,netting_Height);

        for(int i=0; i<numOfReqNetting; i++)
        {
            GameObject nettingChild = WorldSpawnHelper.initObjWithinWorldBounds(nettingPrefab,"Netting-"+i,nettingBounds,spawnPosForWord.z - 1.2f,new bool[] {false,true,false});
            nettingChild.transform.parent = nettingParent.transform;
            nettingBounds.x += nettingBounds.width;
        }

        // Attach to harness.
        Transform harnessGObj = chuteGObj.transform.FindChild("Harness");
        if(harnessGObj == null) { harnessGObj = (new GameObject("Harness")).transform; harnessGObj.parent = chuteGObj.transform; }
        Transform oldWordHolder = harnessGObj.FindChild("WordHolder");
        if(oldWordHolder != null) { Destroy(oldWordHolder.gameObject); }
        Transform oldNetting = harnessGObj.FindChild("Netting");
        if(oldNetting != null) { Destroy(oldNetting.gameObject); }
        wordHolder.transform.parent = harnessGObj;
        nettingParent.transform.parent = harnessGObj;

        //caMang.init("PipeEmergeSequence",cmdBatchList);

        respondToEvent("DeliveryChute","DeliveryChuteEmitWord",null);
    }
Example #45
0
 public SpatialHasher(GridProperties para_hasherGProp)
 {
     hasherGProp = para_hasherGProp;
     bucketMap = new Dictionary<string, HashingBucket>();
     totItemCount = 0;
 }
Example #46
0
    public void init(int[] para_mapSize,
	                 GridProperties para_gPropMapWorldBounds,
	                 BasicNavGraph para_worldNavGraph,
	                 ITerrainHandler para_terrainHandle,
	                 bool para_canWalk)
    {
        //mapSize = para_mapSize;
        gPropMapWorldBounds = para_gPropMapWorldBounds;
        worldNavGraph = para_worldNavGraph;
        terrainHandle = para_terrainHandle;

        currSpeed = walkSpeed;
        canWalk = para_canWalk;
    }