Пример #1
0
        public override ScriptObject Clone(bool deep)
        {
            var ret = new ScriptArray(m_Script);

            ret.m_Objects = new ScriptValue[m_Length];
            ret.m_Length  = m_Length;
            if (deep)
            {
                for (int i = 0; i < m_Length; ++i)
                {
                    var value = m_Objects[i];
                    if (value.valueType == ScriptValue.scriptValueType)
                    {
                        var scriptObject = value.scriptValue;
                        if (scriptObject != this && (scriptObject is ScriptArray || scriptObject is ScriptMap))
                        {
                            ret.m_Objects[i] = new ScriptValue(scriptObject.Clone(true));
                        }
                        else
                        {
                            ret.m_Objects[i] = value;
                        }
                    }
                    else
                    {
                        ret.m_Objects[i] = value;
                    }
                }
            }
            else
            {
                for (int i = 0; i < m_Length; ++i)
                {
                    ret.m_Objects[i] = m_Objects[i];
                }
            }
            return(ret);
        }
Пример #2
0
        public override ScriptObject Clone()
        {
            ScriptArray ret = m_Script.CreateArray();

            ret.m_listObject = new ScriptObject[m_size];
            ret.m_size       = m_size;
            for (int i = 0; i < m_size; ++i)
            {
                if (m_listObject[i] == this)
                {
                    ret.m_listObject[i] = ret;
                }
                else if (m_listObject[i] == null)
                {
                    ret.m_listObject[i] = m_null;
                }
                else
                {
                    ret.m_listObject[i] = m_listObject[i].Clone();
                }
            }
            return(ret);
        }
Пример #3
0
        public override ScriptObject Clone()
        {
            ScriptArray array = base.m_Script.CreateArray();

            array.m_listObject = new ScriptObject[this.m_size];
            array.m_size       = this.m_size;
            for (int i = 0; i < this.m_size; i++)
            {
                if (this.m_listObject[i] == this)
                {
                    array.m_listObject[i] = array;
                }
                else if (this.m_listObject[i] == null)
                {
                    array.m_listObject[i] = this.m_null;
                }
                else
                {
                    array.m_listObject[i] = this.m_listObject[i].Clone();
                }
            }
            return(array);
        }
Пример #4
0
 internal Enumerator(ScriptArray list)
 {
     this.list    = list;
     this.index   = 0;
     this.current = null;
 }