Exemple #1
0
    public void setSkillFilter(HexCoordinates coordinate, int size, int action)
    {
        if (hexFilter != null)
        {
            clearHexFilter();
        }
        hexFilter = Instantiate <HexFilter>(hexFilterPrefab);
        hexFilter.transform.SetParent(transform, false);

        for (int x = -size; x <= size; x++)
        {
            int iX = x + coordinate.X;

            if ((iX < 0 || iX >= width))
            {
                continue;
            }
            for (int y = Mathf.Max(-size, -x - size); y <= Mathf.Min(size, -x + size); y++)
            {
                int iY = y + coordinate.Y;

                if (((iY + iX / 2) < 0 || (iY + iX / 2) >= height))
                {
                    continue;
                }

                int index = iX + (iY + iX / 2) * width;

                if (cells[index] != null && (cells[index].mapType != 1 && cells[index].mapType != 2))
                {
                    hexFilter.setFilter(HexCoordinates.FromOffsetCoordinates(iX, iY + iX / 2), action);
                }
            }
        }
    }
Exemple #2
0
 public void clearHexFilter()
 {
     if (hexFilter == null)
     {
         return;
     }
     Destroy(hexFilter.gameObject);
     hexFilter = null;
 }
Exemple #3
0
    public void ChangeFilter()
    {
        int id = (int)m_currentFilter;

        if (id == Enum.GetNames(typeof(HexFilter)).Length - 1)
        {
            id = 0;
        }
        else
        {
            id++;
        }
        m_currentFilter = (HexFilter)id;
    }
Exemple #4
0
    public List <HexCoordinates> setMoveFilter(HexCoordinates coordinate, int size)
    {
        if (hexFilter != null)
        {
            clearHexFilter();
        }
        hexFilter = Instantiate <HexFilter>(hexFilterPrefab);
        hexFilter.transform.SetParent(transform, false);

        List <HexCoordinates> coordinates = canMoveCoordinates(coordinate, 0, size);

        for (int i = 0; i < coordinates.Count; i++)
        {
            hexFilter.setFilter(coordinates[i], 1);
        }

        return(coordinates);
    }
Exemple #5
0
        public void SetFilter(HexFilter filter)
        {
            m_filter = filter;

            SetBlankFill(false);
            SetColor(Color.white);
            overlayRenderer.sprite = null;
            overlayRenderer.transform.localScale = new Vector3(1, 1);
            overlayRenderer.transform.rotation   = Quaternion.identity;
            topRender.sprite = m_topSprite;

            if (filter == HexFilter.PLATE)
            {
                render.color    = GameManager.Singleton.World.GetPlateByID(hexData.plateId).color;
                topRender.color = GameManager.Singleton.World.GetPlateByID(hexData.plateId).color;
            }
            else if (filter == HexFilter.TEMP)
            {
                float tempScale = (hexData.temp - VERY_COLD) / (VERY_HOT - VERY_COLD);
                Color hot       = new Color(1, 0, 0, 1);
                Color cold      = new Color(0, 0, 1, 1);
                Color c         = Color.Lerp(cold, hot, tempScale);

                render.color    = c;
                topRender.color = c;
            }
            else if (filter == HexFilter.CELL)
            {
                topRender.color = new Color(255f / ((hexData.cellid + 1) * 2) / 255f, 255f / (hexData.cellid + 1) / 255f, 0);
                SetBlankFill(true);

                if (hexData.cellid == 0)
                {
                    overlayRenderer.sprite = GameManager.Singleton.SpriteManager.neutral;
                }
                else
                {
                    overlayRenderer.sprite             = GameManager.Singleton.SpriteManager.arrow;
                    overlayRenderer.transform.rotation = GameManager.Singleton.World.windManager.GetRotationFromWind(wind.direction);
                }
                overlayRenderer.transform.localScale = new Vector3(.25f, .25f);
            }
        }
Exemple #6
0
    void Awake()
    {
        hexFilter = Instantiate <HexFilter>(hexFilterPrefab);
        hexFilter.transform.SetParent(transform, false);

        hexMesh = GetComponentInChildren <HexMesh>();
        maps    = Resources.LoadAll <Sprite>("sprite/map");

        string json = File.ReadAllText("Assets/Resources/database/stage1.json");

        mapDetail = JsonUtility.FromJson <JsonMap>(json);
        width     = mapDetail.width;
        height    = mapDetail.height;

        cells = new HexCell[height * width];

        for (int y = 0, i = 0; y < mapDetail.height; y++)
        {
            for (int x = 0; x < mapDetail.width; x++)
            {
                CreateCell(x, y, i++);
            }
        }
    }
Exemple #7
0
    protected void btnOk_Click(object sender, EventArgs e)
    {
        Document document = new Document();

        lblResult.Text = string.Empty;

        obj = new NameSpace();

        obj.namespaces = lstBrowser.SelectedValue;

        if (FileUploadControl.HasFile)
        {
            string fileExt = System.IO.Path.GetExtension(FileUploadControl.FileName);

            if (fileExt == ".docx")
            {
                //do what you want with this file
            }
            else
            {
                lblResult.Text = "Only .docx files are allowed!";

                return;
            }

            if (lstBrowser.SelectedValue == "")
            {
                lblResult.Text = "Please select file and assign namespace to the page before submit";

                return;
            }
            else
            {
                string file = Path.GetFileName(FileUploadControl.FileName);

                FileUploadControl.SaveAs(Server.MapPath("~/DOCFile/") + file);

                document.LoadFromFile(Server.MapPath("~/DOCFile/" + file), FileFormat.Docx);

                document.SaveToFile(Server.MapPath("~/XMLDocument/prexml.xml"), FileFormat.Xml);

                if (chkEnglishVersion.Checked)
                {
                    obj.englishversion = true;
                }
                else
                {
                    obj.englishversion = false;
                }


                string clearfile = string.Empty;

                try
                {
                    clearfile = HexFilter.MakeFileClear(Server.MapPath("~/XMLDocument/prexml.xml"));
                }
                catch (Exception ex)
                {
                    ExceptionHandling.errorMessage = ex.ToString();

                    lblException.Text = ex.ToString();

                    return;
                }


                try
                {
                    XMLParser xdata = new XMLParser(clearfile, obj);

                    s = new Site("wiki", "smartgrid2013", "xml", obj);

                    address = new Uri("http://smartgrid.hiof.no/wiki/api.php?");

                    //Site s = new Site("Syntef", "dhruba1234", "xml", obj);

                    //Uri address = new Uri("http://localhost:8080/mediawiki/api.php?");

                    s.login(address);

                    s.GetMainPageTableOfContent(xdata);

                    if (s.Edit(xdata).Contains("result=\"Success\""))
                    {
                        lblResult.Text = "Delivery succeed !";

                        lblException.Text = string.Empty;
                    }
                    else
                    {
                        lblResult.Text = "Delivery failed!";

                        lblException.Text = "File may not be in standard use-case format!Please check!";
                    }

                    ClearFolder(Server.MapPath("~/DOCFile/"));
                }
                catch (Exception ex)
                {
                    ExceptionHandling.errorMessage = ex.ToString();

                    lblException.Text = ex.ToString();

                    return;
                }

                lstBrowser.ClearSelection();
            }
        }
        else
        {
            lblResult.Text = "Please select file before submit";

            return;
        }
    }