static void main(string[] args)
    {
        ObjectManager objects = new ObjectManager();

        objects.AddObject(objects.CreateObject("object 1"));
        objects.AddObject(objects.CreateObject("object 2"));
        objects.AddObject(objects.CreateObject("object 3"));
    }
Exemplo n.º 2
0
    public override void Initialize()
    {
        ForcePosition  = new Vector3();
        MyPosition     = transform.position;
        TargetPosition = MyPosition;

        gameObject.AddComponent <Rigidbody>();

        BoxCollider c = gameObject.AddComponent <BoxCollider>();

        c.center = new Vector3(0, 0.5f, 0);


        //オブジェクトの追加
        ObjectManager.AddObject(gameObject);


        transform.tag = "Object";


        foreach (Transform t in this.transform)
        {
            t.gameObject.layer = 8;
        }
        ////透過マテリアルを追加
        //foreach (MeshRenderer g in GetComponentsInChildren<MeshRenderer>())
        //{
        //    g.sharedMaterials = new Material[]
        //    {
        //            g.sharedMaterial,Resources.Load("Shaders/HideOnly")as Material
        //    };
        //}
    }
Exemplo n.º 3
0
    // Start is called before the first frame update
    void Start()
    {
        //ObjectManager.AddObject(door1);
        //ObjectManager.AddObject(door2);

        ObjectManager.AddObject(throwBro);

        ObjectManager.AddObject(player);
    }
Exemplo n.º 4
0
        private void btnDraw_Click(object sender, System.EventArgs e)
        {
            IDataManager idm = new DBDataManager();
            FormulaChart fc  = FormulaChart.CreateChart(idm["MSFT"]);

            fc.EndTime   = new DateTime(2004, 1, 9);
            fc.StartTime = fc.EndTime.AddMonths(-8);

            ObjectManager om = ObjectManager.FromChart(fc);

            if (cbPriceLabel.Checked)
            {
                LabelObject lo = new LabelObject();
                lo.InitPriceDateLabel();
                lo.ControlPoints[0] = GetObjectPoint(tbPriceDate.Text, tbLablePrice.Text);
                om.AddObject(lo);
            }
            ;

            if (cbArrowLine.Checked)
            {
                LineObject lo = new LineObject();
                lo.LinePen.Width     = 5;
                lo.LinePen.Color     = Color.Red;
                lo.LinePen.Alpha     = 100;
                lo.LinePen.DashStyle = DashStyle.DashDotDot;
                lo.InitArrowCap();
                lo.ControlPoints[0] = GetObjectPoint(tbArrowStartDate.Text, tbArrowStartPrice.Text);
                lo.ControlPoints[1] = GetObjectPoint(tbArrowStopDate.Text, tbArrowStopPrice.Text);
                om.AddObject(lo);
            }

            if (cbRegression.Checked)
            {
                LinearRegressionObject lro = new LinearRegressionObject();
                lro.InitChannel();
                lro.ControlPoints[0] = GetObjectPoint(tbRegStartDate.Text, "10");
                lro.ControlPoints[1] = GetObjectPoint(tbRegStopDate.Text, "10");
                lro.ShowAuxLine      = true;
                om.AddObject(lro);
            }
            ibChart.ImageUrl = fc.SaveToWeb(800, 600);
        }
Exemplo n.º 5
0
    public override void Initialize()
    {
        anim = GetComponent <Animator>();
        //anim.updateMode = AnimatorUpdateMode.AnimatePhysics;
        anim.applyRootMotion = true;

        gameObject.AddComponent <Rigidbody>().freezeRotation = true;
        gameObject.AddComponent <BoxCollider>();
        gameObject.GetComponent <BoxCollider>().center = new Vector3(0, 0.5f, 0);
        searchHeight = 200.0f;
        searchRange  = 45.0f;
        SetSpeed(0.01f);
        //SetSpeed(transform.localScale.magnitude);
        MyDirection = transform.forward;

        HP = 300;
        //食べられたポイント
        eatPoint = 3;

        transform.tag = "Object";

        foreach (Transform t in this.transform)
        {
            t.gameObject.layer = 8;
        }

        try
        {
            foreach (MeshRenderer g in GetComponentsInChildren <MeshRenderer>())
            {
                g.sharedMaterials = new Material[]
                {
                    g.sharedMaterial, Resources.Load("Textures/HideOnly") as Material
                };
            }
        }
        catch { }

        //オブジェクトの追加
        ObjectManager.AddObject(gameObject);

        if (gameObject.GetComponent <AudioSource>() == null)
        {
            AC = gameObject.AddComponent <AudioSource>();
        }
    }
Exemplo n.º 6
0
    protected static LogicObject _Create(string name = null, System.Type type = null, bool initialize = true)
    {
        var hash = type.GetHashCode();
        var p    = m_pool.Get(hash);

        if (p == null)
        {
            p = new Pool <LogicObject>(256, type); m_pool.Add(hash, p);
        }

        var obj = p.Pop();

        obj.name = name ?? string.Empty;

        if (initialize)
        {
            obj.Initialize();
        }

        ObjectManager.AddObject(obj);

        return(obj);
    }
        /// <summary>
        /// Brings up the open file dialogue
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Open_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog fileBrowser = new OpenFileDialog();

            fileBrowser.DefaultExt = ".xml";

            if (fileBrowser.ShowDialog() == true)
            {
                List <CelestialObject> xmlObjects = Load.ReadXMLFromPath(fileBrowser.FileName);
                if (xmlObjects == null)
                {
                    MessageBox.Show("Invalid file.");
                }
                else
                {
                    ObjectManager.ClearObjects();
                    xmlObjects.ForEach(x => ObjectManager.AddObject(x as CelestialObject));

                    ObjectsView.ItemsSource = null;
                    ObjectsView.ItemsSource = ObjectManager.AllObjects;
                }
            }
        }
Exemplo n.º 8
0
    protected static T _Create <T>(string name = null, bool initialize = true) where T : LogicObject
    {
        var t    = typeof(T);
        var hash = t.GetHashCode();
        var p    = m_pool.Get(hash);

        if (p == null)
        {
            p = new Pool <LogicObject>(256, t); m_pool.Add(hash, p);
        }

        var obj = (T)p.Pop();

        obj.name = name ?? string.Empty;

        if (initialize)
        {
            obj.Initialize();
        }

        ObjectManager.AddObject(obj);

        return(obj);
    }
        /// <summary>
        /// Loads the solar system preset into the program
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SolarSystem_Click(object sender, RoutedEventArgs e)
        {
            string filePath = ComputingProject_UserInterface.Resources.Preset.SolarSystem;

            List <CelestialObject> xmlObjects = new List <CelestialObject>();

            xmlObjects = Load.ReadXML(filePath);

            if (xmlObjects == null)
            {
                MessageBox.Show("Invalid file or file is empty.");
            }
            else
            {
                ObjectManager.ClearObjects();
                xmlObjects.ForEach(x => ObjectManager.AddObject(x as CelestialObject));

                ObjectsView.ItemsSource = null;
                ObjectsView.ItemsSource = ObjectManager.AllObjects;

                ObjectsViewVelocityPosition.ItemsSource = null;
                ObjectsViewVelocityPosition.ItemsSource = ObjectManager.AllObjects;
            }
        }
Exemplo n.º 10
0
 /// <summary>
 /// Function that runs the first time the window is created.
 /// </summary>
 private static void Win_Load()
 {
     ObjectManager.AddObject(new GLRectangle(new RectangleF(new PointF(-.2f, -.2f), new SizeF(.2f, .2f)), "Rectangle 1"));
     ObjectManager.AddObject(new GLRectangle(new RectangleF(new PointF(.1f, .1f), new SizeF(.2f, .2f)), "Rectangle 2"));
 }
Exemplo n.º 11
0
    public static void CallAddObject(string strIdent)
    {
        try
        {
            Game game = Game.Instance;
            if (game == null || game.mGameClient == null)
            {
                return;
            }

            IGameSceneObj sceneObj = game.mGameClient.GetSceneObj(strIdent);
            if (sceneObj == null)
            {
                return;
            }

            IObject cObj = null;
            int     type = 0;
            if (!sceneObj.QueryPropInt("ObjectType", ref type))
            {
                LogSystem.Log("could not find type : ", strIdent);

                return;
            }

            string strModel = string.Empty;
            if (!sceneObj.QueryPropString("ResourcePath", ref strModel))
            {
                LogSystem.Log("could not find ResourcePath : ", strIdent);

                return;
            }

            ObjectType ObjType = (ObjectType)type;

            switch (ObjType)
            {
            case ObjectType.ObjectType_Player:
                if (game.mGameClient.IsPlayer(strIdent))
                {
                    cObj = new CRoleObject();
                    ObjectManager.mRole = cObj as CRoleObject;
                }
                else
                {
                    cObj = new CPlayerObject();
                }
                break;

            case ObjectType.ObjectType_Npc:
                cObj = new CNpcObject();
                break;

            case ObjectType.ObjectType_Monster:
                cObj = new CMonsterObject();
                break;

            case ObjectType.ObjectType_Soldier:
            case ObjectType.ObjectType_Creeps:

                break;

            case ObjectType.ObjectType_Born:
                break;
            }

            if (cObj != null)
            {
                cObj.mObjectType   = ObjType;
                cObj.mGameSceneObj = sceneObj;
                cObj.mObjectRes    = strModel;
                cObj.mStrIdent     = strIdent;
                cObj.OnAddObject();
                ObjectManager.AddObject(strIdent, cObj);
                if (cObj is CRoleObject)
                {
                    //GUIManager.CacheView<CharacterPanel>();
                    //GUIManager.CacheView<PlayerMainViewPanel>();
                    //GUIManager.CacheView<PlayerControlPanel>();
                    //GUIManager.CacheView<PlayerStatePanel>();
                    //GUIManager.CacheView<PlayerMapControlPanel>();
                    //GUIManager.CacheView<MainChatPanel>();

                    // 添加到主角的AOI中
                }
                else
                {
                    RangeTools.MotifyObjectAoi(mRole, cObj);
                }
            }
        }
        catch (System.Exception ex)
        {
            LogSystem.LogError("on_add_object catch error", ex.ToString());
        }
    }
Exemplo n.º 12
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "function", "<script>reallowOp();</script>", false);
            string errMsg = string.Empty;

            DocsPaWR.Oggetto  oggetto    = new DocsPaWR.Oggetto();
            DocsPaWR.Registro registro   = new DocsPaWR.Registro();
            DocsPaWR.Oggetto  oggettoDoc = new DocsPaWR.Oggetto();

            #region controls
            //check on insert object

            bool result;

            if (this.GridSearchObject.SelectedIndex == -1)
            {
                errMsg = "ErrorObjectSelectRecordMod";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ErrorObjectSelectRecordMod", "parent.ajaxDialogModal('" + errMsg + "', 'warning', 'ATTENZIONE');", true);
                return;
            }

            if (string.IsNullOrEmpty(this.TxtDescObject.Text))
            {
                errMsg = "ErrorObjectNoObject";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ErrorObjectNoObject", "parent.ajaxDialogModal('" + errMsg + "', 'warning', 'ATTENZIONE');", true);
                return;
            }

            //check on the length of the object (up to 2000 characters.)
            if (this.TxtDescObject.Text.Length > 2000)
            {
                errMsg = "ErrorObjectLength";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ErrorObjectLength", "parent.ajaxDialogModal('" + errMsg + "', 'warning', 'ATTENZIONE');", true);
                return;
            }

            #endregion

            oggettoDoc.daAggiornare = true;

            int selRow = this.GridSearchObject.SelectedIndex;
            oggetto.descrizione = this.TxtDescObject.Text.Trim(); //.Replace("'", "''"); Escape gestito dai WS

            //Adding the object code if there
            if (!string.IsNullOrEmpty(this.TxtCodObject.Text.Trim()))
            {
                oggetto.codOggetto = this.TxtCodObject.Text.Trim(); //.Replace("'", "''"); Escape gestito dai WS
            }
            else
            {
                oggetto.codOggetto = string.Empty;
            }

            if (selRow > -1 && selRow < this.GridSearchObject.Rows.Count)
            {
                oggettoDoc.systemId    = (GridSearchObject.Rows[selRow].Cells[(int)oggettario.systemid].FindControl("systemid") as Label).Text;
                oggettoDoc.descrizione = (GridSearchObject.Rows[selRow].Cells[(int)oggettario.description].FindControl("lblDescObject") as Label).Text;
                oggettoDoc.descrizione = oggettoDoc.descrizione; //.Replace("'", "''"); Escape gestito dai WS

                //recovery the registry of the selected object for editing
                Label lblRegCode = (Label)GridSearchObject.Rows[selRow].Cells[(int)oggettario.registrycode].FindControl("lblRegCode");
                registro.codice = lblRegCode.Text;
                for (int regNum = 0; regNum < this.ObjectRegistryList.Length; regNum++)
                {
                    if (this.ObjectRegistryList[regNum].codRegistro.ToLower().Equals(registro.codice.ToLower()))
                    {
                        registro.systemId = this.ObjectRegistryList[regNum].systemId;
                        break;
                    }
                }

                /*
                 * if (!string.IsNullOrEmpty(this.TxtCodObject.Text.Trim()))
                 * {
                 *  if ((from obj in ObjectstListAll where obj.codOggetto.Equals(this.TxtCodObject.Text.Trim()) && obj.codRegistro.Equals(registro.codice) && !obj.systemId.Equals(oggettoDoc.systemId) select obj).Count() > 0)
                 *  {
                 *      errMsg = "ErrorObjectCodePresent";
                 *      ScriptManager.RegisterStartupScript(this, this.GetType(), "ErrorObjectCodePresent", "parent.ajaxDialogModal('" + errMsg + "', 'warning', 'ATTENZIONE');", true);
                 *      return;
                 *  }
                 * }
                 * if ((from obj in ObjectstListAll where obj.descrizione.Equals(this.TxtDescObject.Text.Trim()) && obj.codRegistro.Equals(registro.codice) && !obj.systemId.Equals(oggettoDoc.systemId) select obj).Count() > 0)
                 * {
                 *  errMsg = "ErrorObjectVoicePresent";
                 *  ScriptManager.RegisterStartupScript(this, this.GetType(), "ErrorObjectVoicePresent", "parent.ajaxDialogModal('" + errMsg + "', 'warning', 'ATTENZIONE');", true);
                 *  return;
                 * }
                 */
                if (string.IsNullOrEmpty(registro.systemId))
                {
                    registro = null;
                }
                oggettoDoc.codOggetto = (GridSearchObject.Rows[selRow].Cells[(int)oggettario.codobject].FindControl("lblCodObject") as Label).Text;

                try
                {
                    result = ObjectManager.DeleteObject(this, oggettoDoc);
                    if (result)
                    {
                        oggetto = ObjectManager.AddObject(this, oggetto, registro, ref errMsg);
                        if (!string.IsNullOrEmpty(errMsg) || oggetto == null)  //In the case of failure to enter recovery from deletion
                        {
                            oggetto = ObjectManager.AddObject(this, oggettoDoc, registro, ref errMsg);
                            errMsg  = "ErrorObjectPresent";
                            ScriptManager.RegisterStartupScript(this, this.GetType(), "ErrorObjectPresent", "parent.ajaxDialogModal('" + errMsg + "', 'warning', 'ATTENZIONE');", true);
                            return;
                        }
                        if (this.ObjectstList != null && this.ObjectstList.Count() > 0 && (from o in ObjectstList where o.systemId.Equals(oggettoDoc.systemId) select o).FirstOrDefault() != null)
                        {
                            oggetto.codRegistro = registro != null ? registro.codice : string.Empty;
                            //List<int> index = (from a in ObjectstList.Select((item, i) => new { obj = item, index = i }) where a.obj.systemId.Equals(oggettoDoc.systemId) select a.index).ToList();
                            int index = ObjectstList.Select((item, i) => new { obj = item, index = i }).First(item => item.obj.systemId.Equals(oggettoDoc.systemId)).index;
                            ObjectstList[index] = oggetto;
                        }
                    }
                    else
                    {
                        errMsg = "ErrorObjectPresent";
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "ErrorObjectPresent", "parent.ajaxDialogModal('" + errMsg + "', 'warning', 'ATTENZIONE');", true);
                        return;
                    }
                }
                catch (Exception err)
                {
                    throw new Exception("ERROR: " + err.Message);
                }
            }
            this.GridSearchObject.EditIndex     = -1;
            this.GridSearchObject.SelectedIndex = -1;
            this.BtnOk.Enabled           = false;
            this.ObjectBtnDelete.Enabled = false;
            this.TxtCodObject.Text       = string.Empty;
            this.TxtDescObject.Text      = string.Empty;
            (GridSearchObject.Rows[selRow].Cells[(int)oggettario.systemid].FindControl("systemid") as Label).Text         = oggetto.systemId;
            (GridSearchObject.Rows[selRow].Cells[(int)oggettario.codobject].FindControl("lblCodObject") as Label).Text    = oggetto.codOggetto;
            (GridSearchObject.Rows[selRow].Cells[(int)oggettario.description].FindControl("lblDescObject") as Label).Text = oggetto.descrizione;
            this.UpdPnlGridSearch.Update();
            this.UpdPnlCodeObject.Update();
            this.UpPnlButtons.Update();
        }
Exemplo n.º 13
0
        protected void btnInsert_Click(object sender, EventArgs e)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "function", "<script>reallowOp();</script>", false);
            try
            {
                string errMsg = string.Empty;

                DocsPaWR.Oggetto  oggetto  = new DocsPaWR.Oggetto();
                DocsPaWR.Registro registro = new DocsPaWR.Registro();

                #region Validators
                //check on insert of the object
                if (string.IsNullOrEmpty(this.TxtDescObject.Text.Trim()))
                {
                    errMsg = "ErrorObjectNoObject";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ErrorObjectNoObject", "parent.ajaxDialogModal('" + errMsg + "', 'warning', 'ATTENZIONE');", true);
                    return;
                }

                //check over the length of the object (up to 2000 characters.)
                if (this.TxtDescObject.Text.Length > Convert.ToInt32(this.MaxLenghtObject))
                {
                    errMsg = "ErrorObjectLength";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ErrorObjectLength", "parent.ajaxDialogModal('" + errMsg + "', 'warning', 'ATTENZIONE');", true);
                    return;
                }
                #endregion

                //replace single quotes
                oggetto.descrizione = this.TxtDescObject.Text.Trim();// .Replace("'", "''"); Escape viene fatto dai WS


                //Adding the object code if there
                if (!string.IsNullOrEmpty(this.TxtCodObject.Text.Trim()))
                {
                    oggetto.codOggetto = this.TxtCodObject.Text.Trim(); // .Replace("'", "''"); Escape viene fatto dai WS
                }
                else
                {
                    oggetto.codOggetto = "";
                }

                if (this.DdlRegRf.SelectedItem.Value.Equals(""))
                {
                    if (TypeDoc.Equals("p"))                                      // protocol
                    {
                        registro        = RegistryManager.GetRegistryInSession(); //get protocol registry
                        registro.codice = this.DdlRegRf.SelectedItem.Text;
                    }
                    else if (TypeDoc.Equals("psempl"))
                    {
                        // simplified protocol
                        registro = new Registro();
                    }
                    else
                    {
                        registro = null;
                        errMsg   = "ErrorRegisterNotSelected";
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "ErrorRegisterNotSelected", "parent.ajaxDialogModal('" + errMsg + "', 'warning', 'ATTENZIONE');", true);
                        return;
                    }
                }
                else
                {
                    registro.systemId = this.DdlRegRf.SelectedValue.Split('_').First();
                    registro.codice   = this.DdlRegRf.SelectedItem.Text;
                }

                /*
                 * if (!string.IsNullOrEmpty(this.TxtCodObject.Text.Trim()))
                 * {
                 *  if ((from obj in ObjectstListAll where obj.codOggetto.Equals(this.TxtCodObject.Text.Trim()) && obj.codRegistro.Equals(registro.codice) select obj).Count() > 0)
                 *  {
                 *      errMsg = "ErrorObjectCodePresent";
                 *      ScriptManager.RegisterStartupScript(this, this.GetType(), "ErrorObjectCodePresent", "parent.ajaxDialogModal('" + errMsg + "', 'warning', 'ATTENZIONE');", true);
                 *      return;
                 *  }
                 * }
                 * if ((from obj in ObjectstListAll where obj.descrizione.Equals(this.TxtDescObject.Text.Trim()) && obj.codRegistro.Equals(registro.codice) select obj).Count() > 0)
                 * {
                 *  errMsg = "ErrorObjectVoicePresent";
                 *  ScriptManager.RegisterStartupScript(this, this.GetType(), "ErrorObjectVoicePresent", "parent.ajaxDialogModal('" + errMsg + "', 'warning', 'ATTENZIONE');", true);
                 *  return;
                 * }
                 */
                oggetto = ObjectManager.AddObject(this, oggetto, registro, ref errMsg);

                if (oggetto != null)
                {
                    oggetto.codRegistro = registro.codice;
                    List <Oggetto> listObj = new List <Oggetto>();
                    listObj.Add(oggetto);

                    /*
                     * List<Oggetto> l = ObjectstListAll.ToList<Oggetto>();
                     * l.Add(oggetto);
                     * ObjectstListAll = l.ToArray<Oggetto>();
                     * */
                    this.GridSearchObject.DataSource = listObj;
                    this.GridSearchObject.DataBind();
                    this.GridSearchObject.SelectedIndex = 0;
                    this.GridSearchObject.Visible       = true;
                    this.BtnOk.Enabled           = true;
                    this.ObjectBtnDelete.Enabled = true;
                    this.UpPnlButtons.Update();
                    this.UpdPnlGridSearch.Update();
                }
                else
                {
                    if (string.IsNullOrEmpty(this.TxtCodObject.Text.Trim()))
                    {
                        errMsg = "ErrorObjectCodeObjectPresent";
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "ErrorObjectCodeObjectPresent", "parent.ajaxDialogModal('" + errMsg + "', 'warning', 'ATTENZIONE');", true);
                    }
                    else
                    {
                        errMsg = "ErrorObjectPresent";
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "ErrorObjectPresent", "parent.ajaxDialogModal('" + errMsg + "', 'warning', 'ATTENZIONE');", true);
                    }
                }
            }
            catch (System.Exception ex)
            {
                UIManager.AdministrationManager.DiagnosticError(ex);
            }
        }
Exemplo n.º 14
0
 private void Awake()
 {
     ObjectManager.AddObject(this);
 }