Пример #1
0
    void Deploy()
    {
        if (_lock)
        {
            return;
        }
        float minx = -(_width * _dim[0]) / 2;
        float miny = -(_height * _dim[1]) / 2;

        _map = new GameObject[_width, _height];

        for (int j = 0; j < _height; ++j)
        {
            GameObject line = new GameObject();
            line.name             = "Row " + j.ToString();
            line.transform.parent = transform;
            for (int i = 0; i < _width; ++i)
            {
                _map[i, j] = new GameObject();
                _map[i, j].transform.parent   = line.transform;
                _map[i, j].transform.position = new Vector3(minx + _dim[0] * i, 0.0f, miny + _dim[1] * j);
                _map[i, j].AddComponent <TileCell>();
                _map[i, j].name = "Col " + i.ToString();
            }
        }
        IconControl icc = this.transform.GetComponent <IconControl>();

        if (icc != null)
        {
            icc._container = this;
            icc.Deploy(_width, _height, _dim[0], _dim[1]);
        }
    }
Пример #2
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
Пример #3
0
    private void Awake()
    {
        attrControls = new Dictionary <string, AttrUIControl>();
        skillIcon    = new List <Transform>();
        Transform skills = this.transform.Find("skills");

        for (int i = 0; i < skills.childCount; i++)
        {
            skillIcon.Add(skills.GetChild(i));

            UIEventListener.Get(skills.GetChild(i).gameObject).onHover = (go, state) => {
                if (state)
                {
                    UITooltip.Show(go.name);
                }
                else
                {
                    UITooltip.Hide();
                }
            };
        }

        lv                    = this.transform.Find("lv").Find("value").GetComponent <UILabel>();
        killed                = this.transform.Find("kill").Find("value").GetComponent <UILabel>();
        soul                  = this.transform.Find("soul").Find("value").GetComponent <UILabel>();
        iconFocus             = this.transform.Find("focus").GetComponent <UITexture>();
        iconFocus.enabled     = false;
        attrControls["hp"]    = new SliderControl(this.transform.FindChild("hp"), null);
        attrControls["mp"]    = new SliderControl(this.transform.FindChild("mp"), null);
        attrControls["exp"]   = new SliderControl(this.transform.FindChild("exp"), null);
        attrControls["atk"]   = new IconControl(this.transform.FindChild("atk"), null);
        attrControls["def"]   = new IconControl(this.transform.FindChild("def"), null);
        attrControls["speed"] = new IconControl(this.transform.FindChild("speed"), null);
        attrControls["luck"]  = new IconControl(this.transform.FindChild("luck"), null);
        attrControls["mind"]  = new IconControl(this.transform.FindChild("mind"), null);
        //Transform hd = this.transform.FindChild("HUDText");
        //this.attacker.GetComponent<ChracterBase>().SetHudText(hd.GetComponent<HUDText>());
        //GameManager.gameMain.RegStateUI(this);
    }
Пример #4
0
 protected void Upload_Click(object sender, EventArgs e)
 {
     if (Allowed_Extension() == true)
     {
         try
         {
             con.Open();
             string folderPath = Server.MapPath("~/Apps/" + appName.Text + "/");
             int    APPID;
             Random r = new Random();
             do
             {
                 APPID = r.Next(1, 100);
                 cmd   = new SqlCommand("select * from App where ID = " + APPID + ";", con);
                 rd    = cmd.ExecuteReader();
             } while (rd.HasRows);                          //Select a unique ID from 1 to 100
             rd.Close();
             if (!Directory.Exists(folderPath))
             {
                 Directory.CreateDirectory(folderPath);
                 string iconPath = Server.MapPath("~/Apps/" + appName.Text + "/" + "img/");
                 Directory.CreateDirectory(iconPath);
                 string filename = "";
                 string iconname = "";
                 if (FControl.HasFile)
                 {
                     try
                     {
                         filename = Path.GetFileName(FControl.FileName);
                         iconname = Path.GetFileName(IconControl.FileName);
                         FControl.SaveAs(folderPath + filename);
                         IconControl.SaveAs(iconPath + iconname);
                         FileInfo fi   = new FileInfo(Convert.ToString(folderPath + Path.GetFileName(FControl.FileName)));
                         FileInfo ic   = new FileInfo(Convert.ToString(folderPath + Path.GetFileName(IconControl.FileName)));
                         long     size = fi.Length / 1024;
                         cmd.CommandText = "insert into App values(" + APPID + ",'" + appName.Text + "','" + Description.Text + "','" + getTypeFromExtension(fi.Extension) + "'," + size + ");" + "insert into AppLocation values(" + APPID + ",'" + fi.Name.ToString() + "');" + "insert into AppIcon values(" + APPID + ",'" + ic.Name.ToString() + "');";
                         cmd.ExecuteNonQuery();
                         foreach (ListItem listItem in Category.Items)
                         {
                             if (listItem.Selected)
                             {
                                 cmd.CommandText = "insert into AppCategory values(" + APPID + "," + listItem.Value + ");";
                                 cmd.ExecuteNonQuery();
                             }
                         }
                         con.Close();
                         StatusLabel.Text = "Upload Status: " + "File Uploaded";
                     }
                     catch (Exception ex)
                     {
                         StatusLabel.Text = "Upload Status: Upload Failed. Reason: " + ex.Message;
                     }
                 }
             }
             else
             {
                 StatusLabel.Text = "Upload Status: App Already Exists";
             }
         }
         catch (Exception ex)
         {
             StatusLabel.Text += "Exception Occured. Reason:" + ex.Message;
         }
     }
     else
     {
         StatusLabel.Text = "Upload Status: Failed. Reason: Category and file type mismatched...";
     }
 }