Beispiel #1
0
        /// <summary>
        /// 删除某条水情数据
        /// </summary>
        /// <param name="stationid"></param>
        /// <param name="time"></param>
        public static void DeleteHourWater(string stationid, DateTime time)
        {
            water v = new water {
                stationid = stationid, datatime = time
            };
            List <water> listWater = new List <water>();

            listWater.Add(v);
            Dictionary <string, object> param = new Dictionary <string, object>();
            //string suffix = "user/updateUser";
            string url = suffix + "/water/deleteWater";

            //string url = "http://127.0.0.1:8088/water/deleteWater";
            Newtonsoft.Json.Converters.IsoDateTimeConverter timeConverter = new Newtonsoft.Json.Converters.IsoDateTimeConverter();
            //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式
            timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
            string jsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(listWater, Newtonsoft.Json.Formatting.None, timeConverter);

            param["water"] = jsonStr;
            try
            {
                string resultJson = HttpHelper.Post(url, param);
            }
            catch (Exception e)
            {
                Debug.Print(e.Message + "数据库保存失败");
            }
            //using (LNRRDB ln = new LNRRDB())
            //{
            //    water w = new water();
            //    w = ln.water.First(i => (i.stationid) == stationid && i.datatime == time);
            //    ln.water.Remove(w);
            //    ln.SaveChanges();
            //}
        }
	void Start() {

		shopitems ["water"] 		= new water();
		shopitems ["kagami"] 		= new kagami();
		shopitems ["omamori"] 		= new omamori();
		shopitems ["komainu"] 		= new komainu();
		shopitems ["whitespell"] 	= new whitespell();
		shopitems ["demonarrows"] 	= new demonArrows();
	}
Beispiel #3
0
    void color(water water)
    {
        float X = water.waterForceX;
        float Y = water.waterForceY;
        var   angle = (150 - (Mathf.Atan2(0 - Y, 0 - X)) * 180 / Mathf.PI) / 360;
        float h, s, v;

        Color.RGBToHSV(colori, out h, out s, out v);
        Color col   = Color.HSVToRGB(angle, s, v);
        float alpha = Mathf.Clamp(Mathf.Sqrt(X * X + Y * Y) * 0.27f, 0.1f, 0.7f);

        col.a = alpha;
        water.GetComponent <SpriteRenderer>().color = col;
        colorComponent.change(col, false);
    }
Beispiel #4
0
    public void loadResources()
    {
        lc  = new leftCoast();
        rc  = new rightCoast();
        wat = new water();

        p = new pnd[7];
        for (int i = 1; i <= 6; ++i)
        {
            p[i]      = new pnd(leftseat[i], leftpos[i]);
            lc.ptr[i] = p[i].obj;
        }



        b = new boot();
        gameObject.AddComponent(typeof(MyGUI));
    }
Beispiel #5
0
    private void fxS(string a)
    {
        water water = editObj.GetComponent <water>();
        float x     = 0;

        if (a != "")
        {
            x = float.Parse(a);
        }
        if (x != water.waterForceX)
        {
            undo.add(editObj, 7, true);
            water.waterForceX = x;
            if (!water.colorChanged)
            {
                color(water);
            }
            undo.add(editObj, 7, false);
        }
    }
Beispiel #6
0
        private void lblPlay_Click(object sender, EventArgs e)
        {
            if (instructionsone.fastplay == 1)
            {
                this.Hide();
                //character.characterImage = Image.FromFile("object.png");

                water w1 = new water();
                w1.ShowDialog();
                this.Close();
            }

            else
            {
                this.Hide();
                //character.characterImage = Image.FromFile("object.png");

                instructionsthree i3 = new instructionsthree();
                i3.ShowDialog();
                this.Close();
            }
        }
Beispiel #7
0
    public void saveMe()
    {
        if (!tempo)
        {
            loadLevel.usesaveName = true;
            fileName           = text.text + ".txt";
            loadLevel.SaveName = text.text;
        }
        else
        {
            fileName = tempofileName + ".txt";
        }

        if (!Directory.Exists(filePath))
        {
            Directory.CreateDirectory(filePath);
        }

        StreamWriter sWriter;

        if (!File.Exists(filePath + "/" + fileName))
        {
            sWriter = File.CreateText(filePath + "/" + fileName);
        }
        else
        {
            sWriter = new StreamWriter(filePath + "/" + fileName);
        }
        GameObject[] player   = GameObject.FindGameObjectsWithTag("Player");
        GameObject[] group    = GameObject.FindGameObjectsWithTag("group");
        GameObject[] ground   = GameObject.FindGameObjectsWithTag("ground");
        GameObject[] water    = GameObject.FindGameObjectsWithTag("water");
        GameObject[] obstacle = GameObject.FindGameObjectsWithTag("obstacle");
        GameObject[] deko     = GameObject.FindGameObjectsWithTag("deko");
        GameObject[] goal     = GameObject.FindGameObjectsWithTag("goal");

        //sWriter.WriteLine("random;"+ll.random);
        sWriter.WriteLine("bg;" + cam.bg1.r.ToString() + "," + cam.bg1.g.ToString() + "," + cam.bg1.b.ToString() + "," + cam.bg2.r.ToString() + "," + cam.bg2.g.ToString() + "," + cam.bg2.b.ToString());
        sWriter.WriteLine("c;" + undo.allThings.Count.ToString());

        if (group != null || group.Length != 0)
        {
            print(group.Length);
            for (int i = 0; i < group.Length; i++)
            {
                string    pos     = posy(group[i].transform.position);
                string    size    = scaly(group[i].transform.localScale);
                string    rot     = roty(group[i].transform.rotation);
                Draggable dragy   = group[i].GetComponent <Draggable>();
                string    physics = dragy.bounciness.ToString("0.####") + ";";
                if (dragy.falling)
                {
                    physics += "1";
                }
                else
                {
                    physics += "0";
                }
                string Lpos = dragy.ObjectLPos.ToString();
                physics += ";" + dragy.mass.ToString("0.####");
                sWriter.WriteLine("gp" + ";" + pos + ";" + size + ";" + rot + ";" + physics + ";" + Lpos);
            }
        }
        if (ground != null || ground.Length != 0)
        {
            for (int i = 0; i < ground.Length; i++)
            {
                string    pos     = posy(ground[i].transform.position);
                string    size    = scaly(ground[i].transform.localScale);
                string    rot     = roty(ground[i].transform.rotation);
                string    col     = coly(ground[i].GetComponent <SpriteRenderer>().color);
                Draggable dragy   = ground[i].GetComponent <Draggable>();
                string    shape   = dragy.Shape.ToString();
                string    physics = dragy.bounciness.ToString("0.####") + ";";
                if (dragy.falling)
                {
                    physics += "1";
                }
                else
                {
                    physics += "0";
                }

                physics += ";" + dragy.mass.ToString("0.####");
                string Lpos = dragy.ObjectLPos.ToString();
                string pa;
                if (ground[i].transform.parent != null)
                {
                    pa = ground[i].transform.parent.GetComponent <Draggable>().ObjectLPos.ToString();
                }
                else
                {
                    pa = "a";
                }
                sWriter.WriteLine("gr" + ";" + pos + ";" + size + ";" + rot + ";" + col + ";" + shape + ";" + physics + ";" + Lpos + ";" + pa);
            }
        }
        if (water != null || water.Length != 0)
        {
            for (int i = 0; i < water.Length; i++)
            {
                string pos    = posy(water[i].transform.position);
                string size   = scaly(water[i].transform.localScale);
                string rot    = roty(water[i].transform.rotation);
                string col    = coly(water[i].GetComponent <SpriteRenderer>().color);
                water  watery = water[i].GetComponent <water>();
                string pow    = watery.waterForceY.ToString("0.####") + ";" + watery.waterForceX.ToString("0.####");
                string colChange;
                if (water[i].GetComponent <water>().colorChanged)
                {
                    colChange = "1";
                }
                else
                {
                    colChange = "0";
                }
                Draggable dragy = water[i].GetComponent <Draggable>();
                string    shape = dragy.Shape.ToString();
                string    Lpos  = dragy.ObjectLPos.ToString();
                string    pa;
                if (water[i].transform.parent != null)
                {
                    pa = water[i].transform.parent.GetComponent <Draggable>().ObjectLPos.ToString();
                }
                else
                {
                    pa = "a";
                }
                sWriter.WriteLine("wa" + ";" + pos + ";" + size + ";" + rot + ";" + col + ";" + pow + ";" + colChange + ";" + shape + ";" + Lpos + ";" + pa);
            }
        }
        if (obstacle != null || obstacle.Length != 0)
        {
            for (int i = 0; i < obstacle.Length; i++)
            {
                string    pos     = posy(obstacle[i].transform.position);
                string    size    = scaly(obstacle[i].transform.localScale);
                string    rot     = roty(obstacle[i].transform.rotation);
                string    col     = coly(obstacle[i].GetComponent <SpriteRenderer>().color);
                Draggable dragy   = obstacle[i].GetComponent <Draggable>();
                string    shape   = dragy.Shape.ToString();
                string    physics = dragy.bounciness.ToString("0.####") + ";";
                if (dragy.falling)
                {
                    physics += "1";
                }
                else
                {
                    physics += "0";
                }
                physics += ";" + dragy.mass.ToString("0.####");
                string Lpos = dragy.ObjectLPos.ToString();
                string pa;
                if (obstacle[i].transform.parent != null)
                {
                    pa = obstacle[i].transform.parent.GetComponent <Draggable>().ObjectLPos.ToString();
                }
                else
                {
                    pa = "a";
                }
                sWriter.WriteLine("ob" + ";" + pos + ";" + size + ";" + rot + ";" + col + ";" + shape + ";" + physics + ";" + Lpos + ";" + pa);
            }
        }
        if (goal != null || goal.Length != 0)
        {
            for (int i = 0; i < goal.Length; i++)
            {
                string    pos   = posy(goal[i].transform.position);
                string    size  = scaly(goal[i].transform.localScale);
                string    rot   = roty(goal[i].transform.rotation);
                string    col   = coly(goal[i].GetComponent <SpriteRenderer>().color);
                Draggable dragy = goal[i].GetComponent <Draggable>();
                string    shape = dragy.Shape.ToString();
                string    Lpos  = dragy.ObjectLPos.ToString();
                string    pa;
                if (goal[i].transform.parent != null)
                {
                    pa = goal[i].transform.parent.GetComponent <Draggable>().ObjectLPos.ToString();
                }
                else
                {
                    pa = "a";
                }
                sWriter.WriteLine("go" + ";" + pos + ";" + size + ";" + rot + ";" + col + ";" + shape + ";" + Lpos + ";" + pa);
            }
        }
        if (deko != null || deko.Length != 0)
        {
            for (int i = 0; i < deko.Length; i++)
            {
                string    pos   = posy(deko[i].transform.position);
                string    size  = scaly(deko[i].transform.localScale);
                string    rot   = roty(deko[i].transform.rotation);
                string    col   = coly(deko[i].GetComponent <SpriteRenderer>().color);
                Draggable dragy = deko[i].GetComponent <Draggable>();
                string    shape = dragy.Shape.ToString();
                string    Lpos  = dragy.ObjectLPos.ToString();
                string    pa;
                if (deko[i].transform.parent != null)
                {
                    pa = deko[i].transform.parent.GetComponent <Draggable>().ObjectLPos.ToString();
                }
                else
                {
                    pa = "a";
                }
                sWriter.WriteLine("de" + ";" + pos + ";" + size + ";" + rot + ";" + col + ";" + shape + ";" + Lpos + ";" + pa);
            }
        }
        if (player != null || player.Length != 0)
        {
            for (int i = 0; i < player.Length; i++)
            {
                string    pos     = posy(player[i].transform.position);
                string    size    = scaly(player[i].transform.localScale);
                string    rot     = roty(player[i].transform.rotation);
                string    col     = coly(player[i].GetComponent <SpriteRenderer>().color);
                Draggable dragy   = player[i].GetComponent <Draggable>();
                string    shape   = dragy.Shape.ToString();
                string    physics = dragy.bounciness.ToString("0.####") + ";" + dragy.mass.ToString("0.####");
                string    Lpos    = dragy.ObjectLPos.ToString();
                string    pa;
                if (player[i].transform.parent != null)
                {
                    pa = player[i].transform.parent.GetComponent <Draggable>().ObjectLPos.ToString();
                }
                else
                {
                    pa = "a";
                }
                sWriter.WriteLine("pl" + ";" + pos + ";" + size + ";" + rot + ";" + col + ";" + shape + ";" + physics + ";" + Lpos + ";" + pa);
            }
        }
        sWriter.WriteLine("end");
        sWriter.Close();

        if (!tempo)
        {
            isSomethingOpen.modified = false;
            openStuff.close();
            message.Message("Level saved");
        }
        else
        {
            tempoPlay = true;
            Application.LoadLevel(2);
        }
    }
Beispiel #8
0
    void doStuff()
    {
        if (editObj.tag == "deko")
        {
            type.text = "decoration";
        }
        else
        {
            type.text = editObj.tag;
        }
        if (editObj.tag != "group")
        {
            colorButton.color = editObj.GetComponent <SpriteRenderer>().color;
            appeareance.SetActive(true);
            physics1.GetComponent <RectTransform>().anchorMax = new Vector2(1, 0.2f);
            physics1.GetComponent <RectTransform>().anchorMin = new Vector2(0, 0);
        }
        else
        {
            physics1.GetComponent <RectTransform>().anchorMax = new Vector2(1, 0.4f);
            physics1.GetComponent <RectTransform>().anchorMin = new Vector2(0, 0.2f);
            appeareance.SetActive(false);
        }
        Transform trans = editObj.transform;

        px.text      = trans.position.x.ToString("0.###");
        py.text      = trans.position.y.ToString("0.###");
        pz.text      = (-trans.position.z).ToString("0.###");
        rot.text     = trans.rotation.eulerAngles.z.ToString("0.###");
        shape.sprite = changeShape.shapes[editObj.GetComponent <Draggable>().Shape];
        if (editObj.tag == "Player")
        {
            scale.SetActive(false);
            flow.SetActive(false);
            physics1.SetActive(false);
            physics2.SetActive(true);
            appeareance.GetComponent <RectTransform>().anchorMax = new Vector2(1, 0.6f);
            appeareance.GetComponent <RectTransform>().anchorMin = new Vector2(0, 0.4f);
            rotation.anchorMax = new Vector2(1, 0.8f);
            rotation.anchorMin = new Vector2(0, 0.6f);
            b2.text            = (editObj.GetComponent <Draggable>().bounciness *100).ToString("0.###");
            m2.text            = (editObj.GetComponent <Draggable>().mass *10).ToString("0.###");
        }
        else
        {
            scale.SetActive(true);
            physics2.SetActive(false);
            rotation.anchorMax = new Vector2(1, 0.6f);
            rotation.anchorMin = new Vector2(0, 0.4f);
            appeareance.GetComponent <RectTransform>().anchorMax = new Vector2(1, 0.4f);
            appeareance.GetComponent <RectTransform>().anchorMin = new Vector2(0, 0.2f);
            sx.text = (trans.localScale.x / 50).ToString("0.###");
            sy.text = (trans.localScale.y / 50).ToString("0.###");
            if (editObj.tag == "water")
            {
                flow.SetActive(true);
                physics1.SetActive(false);
                water water = editObj.GetComponent <water>();
                fx.text = water.waterForceX.ToString("0.####");
                fy.text = water.waterForceY.ToString("0.####");
            }
            else if (editObj.tag == "obstacle" || editObj.tag == "ground" || editObj.tag == "group")
            {
                flow.SetActive(false);
                physics1.SetActive(true);
                b1.text = (editObj.GetComponent <Draggable>().bounciness *100).ToString("0.###");
                m1.text = (editObj.GetComponent <Draggable>().mass *10).ToString("0.###");
                if (editObj.GetComponent <Draggable>().falling)
                {
                    fallingStuff.sprite = falling;
                    m1.gameObject.SetActive(true);
                    mText.SetActive(true);
                }
                else
                {
                    fallingStuff.sprite = notFalling;
                    m1.gameObject.SetActive(false);
                    mText.SetActive(false);
                }
            }
            else
            {
                physics1.SetActive(false);
                flow.SetActive(false);
            }
        }
    }
Beispiel #9
0
        public ZoneTable()
        {
            int          ctx = 0, cta = 0;
            StreamReader reader = new StreamReader(new FileInfo(@"scripts\areadata_cur.txt").FullName);

            while (!reader.EndOfStream)
            {
                string line = reader.ReadLine();
                if (line.Length == 0)
                {
                    continue;
                }

                if (line.StartsWith("//"))
                {
                    continue;
                }

                if (line.StartsWith("area_begin"))
                {
                    L2Zone       zone     = null;
                    ZoneTemplate template = new ZoneTemplate();
                    string[]     d        = line.Split('\t');

                    for (int i = 1; i < d.Length; i++)
                    {
                        if (d[i].Equals("area_end"))
                        {
                            continue;
                        }

                        string param = d[i].Split('=')[0];
                        string val   = d[i].Substring(param.Length + 1);

                        switch (param)
                        {
                        case "name":
                            template.Name = val;
                            break;

                        case "map_no":
                            template._map_no = val;
                            break;

                        case "type":
                        {
                            template.Type = (ZoneTemplate.ZoneType)Enum.Parse(typeof(ZoneTemplate.ZoneType), val);

                            switch (template.Type)
                            {
                            case ZoneTemplate.ZoneType.battle_zone:
                                zone = new battle_zone();
                                break;

                            case ZoneTemplate.ZoneType.peace_zone:
                                zone = new peace_zone();
                                break;

                            case ZoneTemplate.ZoneType.water:
                                zone = new water();
                                break;

                            case ZoneTemplate.ZoneType.no_restart:
                                zone = new no_restart();
                                break;

                            case ZoneTemplate.ZoneType.ssq_zone:
                                zone = new ssq_zone();
                                break;

                            case ZoneTemplate.ZoneType.mother_tree:
                                zone = new mother_tree();
                                template._hp_regen_bonus = 2;
                                template._mp_regen_bonus = 1;
                                break;

                            case ZoneTemplate.ZoneType.damage:
                                zone = new damage();
                                template._damage_on_hp = 200;
                                template._damage_on_mp = 0;
                                break;

                            case ZoneTemplate.ZoneType.poison:
                                zone = new poison();
                                template.setSkill("s_area_a_speed_down");
                                break;

                            case ZoneTemplate.ZoneType.swamp:
                                zone = new swamp();
                                template._move_bonus = -50;
                                break;

                            case ZoneTemplate.ZoneType.instant_skill:
                                zone = new instant_skill();
                                break;
                            }
                        }
                        break;

                        case "affect_race":
                            template._affect_race = val;
                            break;

                        case "entering_message_no":
                            template._entering_message_no = int.Parse(val);
                            break;

                        case "leaving_message_no":
                            template._leaving_message_no = int.Parse(val);
                            break;

                        case "range":
                            template.setRange(val);
                            break;

                        case "move_bonus":
                            template._move_bonus = int.Parse(val);
                            break;

                        case "default_status":
                            template.DefaultStatus = val.Equals("on");
                            break;

                        case "event_id":
                            template._event_id = int.Parse(val);
                            break;

                        case "damage_on_hp":
                            template._damage_on_hp = int.Parse(val);
                            break;

                        case "damage_on_mp":
                            template._damage_on_mp = int.Parse(val);
                            break;

                        case "message_no":
                            template._message_no = int.Parse(val);
                            break;

                        case "target":
                            template._target = (ZoneTemplate.ZoneTarget)Enum.Parse(typeof(ZoneTemplate.ZoneTarget), val);
                            break;

                        case "skill_prob":
                            template._skill_prob = int.Parse(val);
                            break;

                        case "unit_tick":
                            template._unit_tick = int.Parse(val);
                            break;

                        case "initial_delay":
                            template._initial_delay = int.Parse(val);
                            break;

                        case "skill_list":
                            template.setSkillList(val);
                            break;

                        case "skill_name":
                            template.setSkill(val.Substring(1).Replace("]", ""));
                            break;

                        case "exp_penalty_per":
                            template._exp_penalty_per = int.Parse(val);
                            break;

                        case "item_drop":
                            template._item_drop = val.Equals("on");
                            break;
                        }
                    }
                    zone.Name      = template.Name;
                    zone.Template  = template;
                    zone.Territory = new ZoneNPoly(template._x, template._y, template._z1, template._z2);
                    cta++;
                    for (int i = 0; i < template._x.Length; i++)
                    {
                        L2WorldRegion region = L2World.Instance.GetRegion(template._x[i], template._y[i]);
                        if (region != null)
                        {
                            ctx++;
                            // region._zoneManager.addZone(zone);
                        }
                        else
                        {
                            CLogger.error("AreaTable: null region at " + template._x[i] + " " + template._y[i] + " for zone " + zone.Name);
                        }
                    }
                }
            }

            CLogger.info("AreaTable: intercepted " + ctx + " regions with " + cta + " zones");
        }
 public void WaterTracing( water w)
 {
     waterscript=w;
 }
 public void StopWaterTracing(water w)
 {
     if (waterscript==w) waterscript=null;
 }